code_sheep18 2021-11-09 21:39 采纳率: 100%
浏览 692
已结题

MAC电脑在写C++出现sh: pause: command not found

我用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;
}

  • 写回答

1条回答 默认 最新

  • CSDN专家-link 2021-11-10 06:50
    关注

    system("pause")只有windows上能用

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 11月18日
  • 已采纳回答 11月10日
  • 创建了问题 11月9日