int id; cout << "请输入学生的id:"; cin >> id; for (; id <= 0 && id <= 49;) { cout << "输入错误,请输入0-49之间" << endl; cout << "请重新输入学生id:"; cin >> id; } cout<<id<<endl;