Mathur
Joesph
Just google basic stuff try the code by yourself Do it as a creativity Not just as i just wanna complete it fast
klimi
Rip
Joesph
Rip
How many people ask you for their hw😂😂😂?
Mathur
It would be really helpful if someone help me to check my work
Mathur
and correct me
KityaYeanSonn
Can IT be a cyber security
Joesph
You should've said it first
KityaYeanSonn
Or only computer science
KityaYeanSonn
Tell me i need to choose
Pavel
Are there STL algorithms that behave like remove_if but guarantee that the last elements are the elements that matched the conditions of the predicate? https://en.cppreference.com/w/cpp/algorithm/remove Why I need this? I have a container of some objects, I want to find the objects that match some criteria and move them into another container. (std::move_if?)
Javi
It would be really helpful if someone help me to check my work
Before trying to solve a problem, you should learn how to structure a program. Hint #1, you never call main() from any function.
Pavel
That's exactly what remove does
cppreference (see the link above) tells that this behavior is not specified Iterators pointing to an element between the new logical end and the physical end of the range are still dereferenceable, but the elements themselves have unspecified values (as per MoveAssignable post-condition).
︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎
@rextester_bot
Dima
/warn yo had your second chance
Pavel
You are right, but you have remove_copy
Not sure, but remove_copy seems to copy the elements not move them (but I need to check). Also my colleague suggested to have a look at std::partition and std::stable_partition that seem to do what I expected from std::remove_if https://en.cppreference.com/w/cpp/algorithm/partition
Anonymous
👍
Anonymous
hello, I would like to read a big txt file. For this I'm using qt, and my doubt is read file directly with: QTextStream filestream(&qfile); Or to read the file passing througt a memory map: char* memory = reinterpret_cast<char*>(file.map(0, file.size())); and after to use: auto bytes = QByteArray::fromRawData(memory, size); QTextStream istream(bytes);
Javi
Not sure, but remove_copy seems to copy the elements not move them (but I need to check). Also my colleague suggested to have a look at std::partition and std::stable_partition that seem to do what I expected from std::remove_if https://en.cppreference.com/w/cpp/algorithm/partition
"Copies elements from the range [first, last), to another range beginning at d_first, omitting the elements which satisfy specific criteria. Source and destination ranges cannot overlap." It looks what you are trying to do. partition also works, but take into account that it doesn't preserve the order. It only guarantee that those elements that meet the condition get to be before those that don't
rex
void main() { char s[23][50] ={ "beauty is eye in the eye of beholder","beauty is of", "is of", "eye of beholder" }; char s2[]="croc"; char str[10][10]; int i=0,j,k=0,m=3,n; int count=1; for(i=0;i<m;i++) { if(i==1) { while(m>1) { strcpy(s[m+1],s[m]); m--; } } } strcpy(s[1],s2); for(i=0;i<=m;i++) printf("%s\n",s[i]); }
rex
i want to copy a string to in 1st position
rex
but it didnot works
rex
pleaaase correct it
Anonymous
how do you use _Generic
Ilya
Graphs!
then graphviz
Pete
then graphviz
👍 Just plot my inputs and I’ll be able to get the results and compare?
Noble Friend
Ugh what just happened?
Noble Friend
😐
Frik
Ugh what just happened?
They deleted all our chats, I suppose someone does not like it??
Noble Friend
Ohh. I get
Noble Friend
I thought it were my phone
Dima
what’s this
Dima
They deleted all our chats, I suppose someone does not like it??
have you read the rules :D ? for shitposting come to ot
Dima
#ot
Dima
ok, boomer
Noble Friend
Dima
I removed some but not yours
Frik
I removed some but not yours
I would not consider my posts - shit.
Noble Friend
Maybe you didn't check. Actually you deleted all of mine too
Dima
I_Interface
Noble Friend
I did it
Cool. Sir. But that ain't fair at all
klimi
Cool. Sir. But that ain't fair at all
You are right that its not fair, I should have warned you for off topic
klimi
🙄🙄🙄
¯\_ (ツ) _/¯
Dima
Cool. Sir. But that ain't fair at all
what’s your problem to post it again? :<
klimi
NOT HERE
Dima
NOT HERE
what did he post?
Noble Friend
what’s your problem to post it again? :<
You are looking for a reason to ban me? Actually you won't find one⚠️
Dima
no, I am just curious why you are that upset lol
Frik
See new group "C/Cpp"
klimi
Okay my tolerance bar has overflown
Noble Friend
no, I am just curious why you are that upset lol
Lol. Very easy trap😝. I can't be caught in it😃
Noble Friend
Okay my tolerance bar has overflown
OK sir. I won't talk again
Frik
So Im out of here by by all.
klimi
OK sir. I won't talk again
If that is your solution, fine, but don't complain later
Noble Friend
🤝
Anonymous
goto sucks
Anonymous
i need an alternative
Anonymous
lets say i have a user input for a switch statement, what the best way to hand the default case if i want them to be asked the question again
I_Interface
lets say i have a user input for a switch statement, what the best way to hand the default case if i want them to be asked the question again
while(check == true) { ... //your cases printf("question); char answer; scanf(answer); if(answer == y) check = false; } something like that
I_Interface
I see , while loop
or do while, no matter
Anonymous
or do while, no matter
void not_An_Option(){ clearScreen(); int msec = 0, trigger = 1000; clock_t before = clock(); puts("This is not an option. Please learn to follow instructions boozie\n"); do { clock_t difference = clock() - before; msec = difference * 1000 / CLOCKS_PER_SEC; } while ( msec < trigger ); clearScreen(); }
Anonymous
this is a function i wanted to run as an default case, then i wanted it to go back to the question it orginally asked , but i think at this point the variable that stores the answer of the user input is still in the variable