【发布时间】:2021-04-14 23:21:49
【问题描述】:
下面的代码有问题
switch(adminChoice){
case 1:
do{
cout<<"\nEnter Student ID: ";
cin>>studentId;
cout<<"\nEnter Student Name: ";
cin>>studentName;
cout<<"\nEnter Student Password: ";
cin>>studentPassword;
cout<<"\nAdd another account? y/n ";
cin>>adminSubChoice;
}
while(adminSubChoice!='n' || adminSubChoice !='N');
break;
case 2:
当我为 char 变量 adminSubChoice 输入 n 或 N 时,do while 不会中断,它会一次又一次地运行。谁能告诉我我做错了什么??
【问题讨论】:
-
谢谢老兄。我得到了答案,并且在问题 adminSubChoice is char type variable 中也提到了它。
标签: c++ loops data-structures switch-statement do-while