'r' not declared in scope

Joined
Nov 8, 2008
Messages
1
Reaction score
0
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;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top