Hello
I am having difficulty, in all my programs, adding the line "would you like to_____again y/n?"
I would like it to repeat the entire program an infinite amount of times as long as y is pressed and to cout "Thanks for _________. Have a nice day." when n is pressed
(I have gotten it to work once and the program is nice from a users view but the code turned into this weird paradox of for loops inside themselves, its pretty ugly)
Hopefully that makes sense.
Hhere is one of the less complicated examples I am working on:
Any help would be appreciated. Thank You.Code:#include <iostream> #include <time.h> #define MAX_RANGE 100 using namespace std; int main () { int counter; counter=0; int value, input; srand (time(NULL)); value=rand()%MAX_RANGE+1; cout<<"Guess a number between 1 and 100\n\n"; do { cin>> input; counter++; if (value>input) { cout<<"\nI was thinking of a higher number than "<< input <<". Try again.\n\n"; } else if (value<input) { cout<<"\nI was thinking of a lower number than "<< input <<". Try again.\n\n"; } else { cout<<"\nThat's right! I was thinking of "<<input<<". Good game.\n\n"; cin.ignore(); } } while (value!=input); cin.get(); }