EDIT:
I am trying to reference a variable in my class called yolo. The variable is from an input that I want to use in my main (if possible) so I can keep running my called methods in a loop.
I am dead in the water on this one. Thanks
I get the following error below. I know its not in my 'scope' its in my printscreen method. Any suggestions?
100 9 C:\Users\carlos\Documents\My Projects\C++\rps.cpp [Error] 'confirm' was not declared in this scope
I can't reference it basically from my main. If you have any suggestions or fixes please let me know. thanks
your error has nothing to do with your class.
You have not declared the variable 'confirm'. If it's in your printScreen method you could return it from this function so you can use it in main()
also your return statement on line 9 makes no sense. You will reach that line and exit your program.
Yeh I just threw the return 0 bc I thought main always had to return an int if my method doesn't ...
For returning the variable "confirm" which is in the scope of my print screen method... How would the
syntax be in the while loop? I just curious bc I'm on the way to school n going to work on it there.
Mutexe, sorry for the short response i closed my window. That works . I just took the variable out of my function and put it in my main.
Another question though.
I wanted to create a while loop that checks the input, if it matches one of the characters in my array
i have this so far but i know its going to keep looping over and over.
my array is
string answers[6]={"R","r","P","p","S", "s"};
Leaner is just a boolean i have set as false
1 2 3 4 5 6
while(leaner)// while loop will verify the letters are acceptable or not and makes users change them.
{
cout << "Please enter an Acceptable letter representing (R)ock, (P)aper, or (S)cissors: ";
cin >> p1hand;
cout << endl;
}