anonymous
2011-09-22 12:44:02 UTC
(error: name lookup of "x" changed for ISO "for" Scoping)
#include
#include
#include
using namespace std;
int fguess();
int sguess();
int main()
{
fguess();
cin.get();
return 0;
}
int fguess(){
int number;
cout << "Pick a number between 1 and 6 and lets see how you do." << endl;
cin >> number;
srand(time(0));
for (int x= 1; x<=1;x++){
cout << 1 + (rand()%6) << endl;
}
if(number = x){
cout << "Congratulations you guessed the right number!" << endl;
cout << "You won, have another go!" << endl;
sguess();
}
else{
cout <<"You get one more go!" << endl;
sguess();
}
}
int sguess(){
int number;
cout << "Pick a number between 1 and 6 and lets see how you do." << endl;
cin >> number;
srand(time(0));
for (int x= 1; x<=1;x++){
cout << 1 + (rand()%6) << endl;
}
if(number = x){
cout << "Congratulations you guessed the right number!" << endl;
cout << "Have another go!" << endl;
}
else{
cout << "Sorry you didn't win today" << endl;
return 0;
}
}
I'm sure you can figure out what my aim is.
Thanks for the help.