78

压力(超影3000)  •  2天前


include

include

using namespace std;

int main() {

string dish;  // 只需要一个变量,重复使用

// 用for循环为5个学生打菜
for (int i = 1; i <= 5; i++) {
	cout << "第" << i << "个同学,你要什么菜?";
	cin >> dish;  // 每次停在这里等待输入
	cout << "阿姨打" << dish << "给第" << i << "个同学" << endl << endl;
}

cout << "=== 所有同学打完饭 ===" << endl;

return 0;

}


评论:

include

include

using namespace std;

int main() {

string dish;  // 只需要一个变量,重复使用

// 用for循环为5个学生打菜
for (int i = 1; i <= 5; i++) {
	cout << "第" << i << "个同学,你要什么菜?";
	cin >> dish;  // 每次停在这里等待输入
	cout << "阿姨打" << dish << "给第" << i << "个同学" << endl << endl;
}

cout << "=== 所有同学打完饭 ===" << endl;

return 0;

}


压力(超影3000)  •  2天前

请先登录,才能进行评论