I am relatively new at programming and I have an issue with my C++ compiler saying that 'r' was not declared in scope. It is the parameter for the function called "reroll". I have only included parts of the program that would affect this variable, but if the whole program would be best, I can post that. If anyone can help, that would be great!
int reroll (int r); //Prototype
int main ()
{
cout << reroll (r); //Function Call
return 0;
}
int reroll (int r) //Reroll die
{
int y = 1;
int n = 2;
int p;
do
{
cout << "Would you like to re-roll one of your "
<< "die? [y , n]: ";
cin >> p;
} while ( p != 'y' || p != 'n');
return p;
}
int reroll (int r); //Prototype
int main ()
{
cout << reroll (r); //Function Call
return 0;
}
int reroll (int r) //Reroll die
{
int y = 1;
int n = 2;
int p;
do
{
cout << "Would you like to re-roll one of your "
<< "die? [y , n]: ";
cin >> p;
} while ( p != 'y' || p != 'n');
return p;
}