Thread: Noobie question

  1. #46
    Noobie
    Guest
    I mean...where is the tutorial on how to use a function, while loop, and if and statement to output a different message (1 or 2) and should the user enter anything differenet than 1 or 2 ask them to enter again

  2. #47
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    It's all here

  3. #48
    noobie
    Guest
    jeez man-where do u think i learned how to write what i have written-ive been reading that thing all day-it doesnt say how to do this

  4. #49
    noobie
    Guest
    In fact, this code IS derived from the tutorials you are telling me to read-Im trying to add onto the tutorial by making it so u cant enter a non-integer and have it try to use that non-integer-the examples there have the same problem this thing has

  5. #50
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Code:
    char x='0';
    
    cout<<"Please choose a room (1 or 2): ";
    
    while (x!='1' && x!='2')
       cin>>x;
    
    if (x=='1')
      // do room 1 stuff
    if (x=='2')
      // do room 2 stuff

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 12:14 PM
  2. A fourth noobie question - namespace std?
    By Noobie in forum C++ Programming
    Replies: 24
    Last Post: 08-12-2005, 02:10 PM
  3. another noobie question
    By noobie in forum C++ Programming
    Replies: 21
    Last Post: 01-21-2003, 02:04 PM
  4. A third noobie question
    By Noobie in forum C++ Programming
    Replies: 5
    Last Post: 01-21-2003, 12:53 AM