Anonymous
Functions.cpp
klimi
Gn 6.5k ppl
klimi
Gn
<3
Mihail
Functions.cpp
So what function should I look at?
Anonymous
So what function should I look at?
gameMechanics is the main part of the game
Anonymous
And it takes values returned from fillInLetters function
Anonymous
The generateRapperNames chooses a Rappers name randomly using rand function , then the gameMechanic functions allows users to guess the name
BinaryByter
don't use rand()
BinaryByter
because the c++ standard library has got better stuff
BinaryByter
<random>
BinaryByter
a full fucking header just for random numbers
Anonymous
because the c++ standard library has got better stuff
True , I think in few months I gonna read some better books I have about the standard library
Anonymous
And where do you "need" this empty char?
For example , if you look where the names of the Rappers are stored is in an string array
Anonymous
Some of the names have two words
Anonymous
So there is a space in between the names
Anonymous
But the game doesn’t recognize a space as an option ,
Anonymous
Because it accepts characters as a user input
Mihail
So that it'll store the whole name with the spaces
Mihail
Is that what you're asking?
Anonymous
Mihail
Ima give it a shot
https://en.cppreference.com/w/cpp/string/basic_string/getline here is a reference
Mihail
Aren't you guessing whole names?
Mihail
Wait so the issue is that cin will not input past a space, right?
Mihail
I think I didn't understand you correctly
BinaryByter
getline
Mihail
I think that isn't what he's trying to tell me tho
Mihail
Well I have to go to sleep now
Mihail
So gn
Anonymous
Wait so the issue is that cin will not input past a space, right?
Yea I need it to be able to accept just a space
Anonymous
You guess one letter at a time
Anonymous
getline
I tried but doesn’t work , maybe cuz it’s accepting input for a char
BinaryByter
lmao, dude
BinaryByter
getline works on strings
Anonymous
It’s a char
BinaryByter
just do string.c_str()
Anonymous
just do string.c_str()
I will look into it
Anonymous
Anonymous
Smh
Anonymous
That works
Anonymous
Anonymous
That worked the sync
S
https://www.geeksforgeeks.org/create-dynamic-2d-array-inside-class-c/amp/
S.
Not a good practice to do that in C++ I guess. YOu’re proposed to use vector instead
S
https://www.geeksforgeeks.org/find-the-next-lexicographically-greater-word-than-a-given-word/
S
can anybody explain the logic behind the code snippet for without using STL.
Liam
which one?
S
which one?
Sorry , that's by mistake posted.
Liam
can anybody explain the logic behind the code snippet for without using STL.
1. scaning from the back to the front of the string, try to find the first pair of two adjacent elements, say <*i, *ii>, statisfied *i < *ii. 1.1 if such pair was found, scanning from the back to the front of the string, try to find the first element statisfied *j > *i, and swap them, then, reverse [ii, last) and return true. 1.2 if such pair was not found, then, reverse [first, last) and return false.
Liam
1. scaning from the back to the front of the string, try to find the first pair of two adjacent elements, say <*i, *ii>, statisfied *i < *ii. 1.1 if such pair was found, scanning from the back to the front of the string, try to find the first element statisfied *j > *i, and swap them, then, reverse [ii, last) and return true. 1.2 if such pair was not found, then, reverse [first, last) and return false.
A easier impl of next_permutation show the above algorithm: template <typename BidirIter> bool next_permutation(BidirIter first, BidirIter last) { if (first == last or std::next(first) == last) { return false; } else /* lbi */; BidirIter i = std::prev(last); while (true) { BidirIter ii = i; --i; if (*i < *ii) { BidirIter j = last; while (!(*i < *--j)) /* lbi */; // using bsearch could be faster for random access iter. std::iter_swap(i, j); std::reverse(ii, last); return true; } if (i == first) { std::reverse(first, last); return false; } } }
Anonymous
😊
Dima
Lol he has left the group
Dima
-.-
Dima
Fail achieved
klimi
klimi
he spammed it 4 times
Ariana
.-:
Dima
.-:
MDR 9000
Ибраги́м
https://developers.redhat.com/blog/2019/03/08/usability-improvements-in-gcc-9/
Anonymous
Anonymous
hey bros
Anonymous
how you doing?
Anonymous
i ask you something on c++/qt
Anonymous
i created a function that copy html/tables to export excel in clipboard
BinaryByter
google PoCo
Anonymous
but my problem is when i want to copy it, if i got any element this doesn't copy to the clipboard
Anonymous
it's my code
Anonymous
generator = QGuiApplication::clipboard(); QMimeData *d = new QMimeData(); Data = header + completeData + footer; d->setHtml(Data); generator->setMimeData(d);