'r' not declared in scope

Discussion in 'C Programming' started by hartens2, Nov 8, 2008.

  1. hartens2

    hartens2

    Joined:
    Nov 8, 2008
    Messages:
    1
    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;
    }
     
    hartens2, Nov 8, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JohnZing

    declared or not declared ?

    JohnZing, Feb 5, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    1,599
    Jon Paal
    Feb 5, 2006
  2. Kevin Goodsell
    Replies:
    0
    Views:
    436
    Kevin Goodsell
    Sep 21, 2003
  3. Jack Klein
    Replies:
    0
    Views:
    726
    Jack Klein
    Sep 22, 2003
  4. William
    Replies:
    6
    Views:
    111,556
  5. Vaxius
    Replies:
    3
    Views:
    3,469
Loading...

Share This Page