永发信息网

下面是程序代码,编程环境是VC6.0 总出现bug 能帮忙改下么 比如输入的时候输入一堆数字就死循环了

答案:1  悬赏:30  手机版
解决时间 2021-08-12 09:59
  • 提问者网友:趣果有间
  • 2021-08-11 20:32
int Map_1()
{
char option;
string account;
char password;

cout<<"           **************************************************************"<<endl;
cout<<"                                                                         "<<endl;
    cout<<"                                欢迎进入学生信息管理系统                 "<<endl;
cout<<"                                                                         "<<endl;
cout<<"                                                                         "<<endl;
cout<<"                                                                         "<<endl;
cout<<"           **********    1     请输入您的帐号和密码  ********************"<<endl;
cout<<"                                                                         "<<endl;
cout<<"                                                                         "<<endl;
cout<<"                                                                         "<<endl;
cout<<"                                                                         "<<endl;
cout<<"           **********    2        退出本程序         ********************"<<endl;
cout<<"                                                                         "<<endl;
cout<<"                                                                         "<<endl;
cout<<"           **************************************************************"<<endl;

cin>>option;

switch(option)
{
case '1' :
  system("cls");
 
  cout<<"帐号: "<<endl;
  cin>>account;
  cout<<"密码:"<<endl;
  cin>>password; //使密码输出变为密文
  //password = getch();
        
  if(password == '1234')
  {
   cout<<"您输入的密码正确,将跳入主菜单"<<endl;
   cout<<endl;
   cout<<endl;
   cout<<endl;
  
   system("pause");
  
   Menu();
  }
 
  else
  {
   cout<<"您输入的密码错误!"<<endl;
   cout<<"请您重新输入:"<<endl;
   cout<<endl;
            system("pause");
   system("cls");
   Map_1();
  }
 
case '2' : return 0;
  break;
default : 
  system("pause");
  cout<<"您输入错误,请您重新输入!"<<endl;
  cout<<endl;
     system("pause");
  system("cls");
  Map_1();
}

return 0;

}
最佳答案
  • 五星知识达人网友:鱼芗
  • 2021-08-11 21:42
请问您可以把整个代码发过来吗
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯