驱动菜单的雏形6/2/04 9:58AM

驱动菜单的雏形
#include <iostream>
#include <ctype.h>

using namespace std;

int main()
{
  char r;
  cout << "please enter one of the following choices:/n";
  cout << "c) carnirore" << "  " << "  " << "p) pianist/n";
  cout << "t) tree" << " " << "        " << "g) game/n";
  cout << "please enter a c,p,t,or g:";

while(cin >> r)
  {
   r = tolower(r);
   if(r == 'c'|| r == 'p' || r == 't' || r == 'g')
    
    {switch (r)
      {
          case 'c': cout <<"a maple is a carnirore/n";
                            cout << "please enter a c,p,t,or g:";
                                    break;
          case 'p': cout <<"a maple is a pianist/n";
                    cout << "please enter a c,p,t,or g:";
                                    break;
          case 't': cout <<"a maple is a tree/n";
                    cout << "please enter a c,p,t,or g:";
                    
                                    break;
          case 'g': cout <<"a maple is a game/n";
                    cout << "please enter a c,p,t,or g:";
                                    break;
      }
     }
    else
      cout << "please enter a c,p,t,or g:";
       
     
    
  }
 
  return 0;
}

posted on 2004-09-13 16:24  猪猪一号  阅读(95)  评论(0编辑  收藏  举报

导航