-1
我是誰不工作if語句裏面for或while循環
它只能顯示第一COUT進入1個學生信息
或醚它跳過循環,並盡一切下循環它
可以請你幫
int x = 1;
while (x <= 10) {
++x;
if (x = 1) {
cout << "enter 1 student info";
cin >> name >> first >> second >> final>>id;
} else if (x = 2) {
cout << "enter 2 student info";
cin >> name1 >> first1 >> second1 >> final1 >> id1;
} else if (x = 3) {
cout << "enter 3 student info";
cin >> name2 >> first2 >> second2 >> final2 >> id2;
} else if (x = 4) {
cout << "enter 4 student info";
cin >> name3 >> first3 >> second3 >> final3 >> id3;
}
}
...
for (int x = 1; x <= 9; x++) {
if (x = 1) {
cout << "enter 1 student info";
cin >> name >> first >> second >> final>>id;
}
if (x = 2) {
cout << "enter 2 student info";
cin >> name1 >> first1 >> second1 >> final1 >> id1;
}
if (x = 3) {
cout << "enter 3 student info";
cin >> name2 >> first2 >> second2 >> final2 >> id2;
}
if (x = 4) {
cout << "enter 4 student info";
cin >> name3 >> first3 >> second3 >> final3 >> id3;
}
}
「做作經營者」這是一個新的 –
對不起,只是一個法語單詞,謝謝編輯:) – Jerome