ok so the thing is that i have been working on a hangman game and its going good besides one problem i cannot figure out how to show all the letters that have been used on the screen at all times could i get some help??? (by the way it has to be in a function which i dont totally understand either )
string s1;
char guess;
string dash;
int bla = 0;
int x = 0;
int b = 0;
cout << "Let's play hangman.. all you have to do is type in a word and have player 2" << endl << "guess your word but you can only be wrong 6 times" << endl;
getline(cin, s1);
system("cls");
cout << "Guess what the word is one letter at a time :-)" << endl;
dash = s1;
for (int z = 0; z < s1.length(); z++){ dash[z] = '-'; cout << dash[z]; }
cout << endl;
while (b < 6){
cin >> guess;
for (int x = 0; x < s1.length(); x++){
if (guess == s1[x]){ system("cls"); dash[x] = guess; cout << dash << endl; }
else{ system("cls"); bla = bla + 1; cout << dash << endl; }
if (bla == s1.length()){ system("cls"); b = b + 1; cout << " you have: " << 6 - b << " tries left" << endl; }
cout << endl << endl;
Which of the blocks of code are you referring to, OP or mine?
What type of errors - compilation errors?
What are the errors?
What dialect of C++ did you set your compiler to (-std=c++11)?