View Single Post
Old 08-13-2002, 10:54 PM   #5 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,720
redhead is on a distinguished road
As your DoMenu() is made now, it looks like:
Code:
USHORT DoMenu()
{
  USHORT choice;
    cout <<"\n\n***Menu*** \n";
    cout <<"(1) Draw Your Rectangle\n";
    cout <<"(2) Area\n";
    cout <<"(3) Perimeter\n";
    cout <<"(4) Resize\n";
    cout <<"(5) Quit\n";

 cin >> choice;
 return choice;
}
If you wan't to be sure, it only returns with an integer within the 1 - 5 selection, then make it:
Code:
USHORT DoMenu()
{
  USHORT choice = 0;
   while(choice < 1 || choice > 5)
   {
      cout <<"\n\n***Menu*** \n";
      cout <<"(1) Draw Your Rectangle\n";
      cout <<"(2) Area\n";
      cout <<"(3) Perimeter\n";
      cout <<"(4) Resize\n";
      cout <<"(5) Quit\n";
      cin >> choice;
      if(choice < 1 || choice > 5)
          cout << "Sorry your choice of (" << choice
                  << ") is not within the required limit."<<endl
   }
 return choice;
}
Note the above has not been testet..
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote