sj; 指数=stoi(sj); num=stoi(si); }捕获(标准::异常e){ cout,c++,shell,input,parameters,command,C++,Shell,Input,Parameters,Command" /> sj; 指数=stoi(sj); num=stoi(si); }捕获(标准::异常e){ cout,c++,shell,input,parameters,command,C++,Shell,Input,Parameters,Command" />

C++;如何检查Shell输入的编号? 下面是我的C++代码: void test(int array[], int length) { int index; // the index of heap array that human want to modify int num; // the number of heap in the index position cout << "input the index and num" << endl << flush; string si,sj; try{ cin >> si >> sj; index = stoi(sj); num = stoi(si); }catch(std::exception e){ cout << "error, try again" << endl; test(array, length); } if (index <= length && index > 0 && num > 0 && num <= array[index - 1]) { array[index - 1] -= num; // print(array, length); } else { cout << "error, try again" << endl; test(array, length); } } void测试(int数组[],int长度){ int index;//要修改的堆数组的索引 int num;//索引位置的堆数 cout>sj; 指数=stoi(sj); num=stoi(si); }捕获(标准::异常e){ cout

C++;如何检查Shell输入的编号? 下面是我的C++代码: void test(int array[], int length) { int index; // the index of heap array that human want to modify int num; // the number of heap in the index position cout << "input the index and num" << endl << flush; string si,sj; try{ cin >> si >> sj; index = stoi(sj); num = stoi(si); }catch(std::exception e){ cout << "error, try again" << endl; test(array, length); } if (index <= length && index > 0 && num > 0 && num <= array[index - 1]) { array[index - 1] -= num; // print(array, length); } else { cout << "error, try again" << endl; test(array, length); } } void测试(int数组[],int长度){ int index;//要修改的堆数组的索引 int num;//索引位置的堆数 cout>sj; 指数=stoi(sj); num=stoi(si); }捕获(标准::异常e){ cout,c++,shell,input,parameters,command,C++,Shell,Input,Parameters,Command,你应该用它来代替你的输入 然后数一数

你应该用它来代替你的输入

然后数一数