我用Xcode和vscode 都有这个问题,百度了没有找到解决的方法。
#include <iostream>
using namespace std;
int main(){
int select;
while (true)
{
cout << "====================== 欢迎来到机房系统 =====================" << endl;
cout << endl << "请输入您的身份" << endl;
cout << "\t\t -------------------------------\n";
cout << "\t\t| |\n";
cout << "\t\t| 1.学生代表 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 2.老 师 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 3.管 理 员 |\n";
cout << "\t\t| |\n";
cout << "\t\t| 0.退 出 |\n";
cout << "\t\t| |\n";
cout << "\t\t -------------------------------\n";
cout << "输入您的选择: ";
cin>>select;
switch (select)
{
case 1:
break;
case 2:
break;
case 3:
break;
case 0:
cout<<"欢迎下次使用"<<endl;
return 0;
break;
default:
cout << "输入有误,请重新选择!" << endl;
system("pause");
break;
}
}
system("pause");
system("cls");
return 0;
}
system("pause")只有windows上能用