I need to use an array of characters because i'm comparing it to another array of characters. Anyway I tried out both strcpy and strncpy and they both added a bunch of stuff on to the end of the array. How do I stop this from happening?
well now i get a couple hundred upside down question marks after the array is output, so all the correct characters are output, but are followed by the questions marks
I still need it to be an array of character to compare to another array of characters which is filled with random characters. Strings are so messy and difficult...
well the code is broken once again. It won't output guess. At first the program wasn't waiting for user input so I added cin.ignore(), but then it wasn't running through the loop. I moved the cin.ignore() to before the user inputs things and now it runs through the loop, but still nothing is output to the screen
1 2 3 4 5 6 7 8 9 10 11 12 13
void PlayerColors::playersGuess(){
string guess;
cin.ignore();
cout << "What is your guess?: ";
getline(cin, guess);
cin.clear();
cout << guess;
for(int i = 0; i<guess.size(); i++){
cout << guess[i];
}
}
Only thing I can think of is you have a cin occurring before this function is called that is messing it up. Do you have a cin occurring before this function is called?