cout << "Get ready to enter in the total rainfall for year " << yearCount << ".\n";
for (months = 1; months <= 12; months ++)
cout << "Please enter the total rainfall for ";
if (months == 1)
cout << "January.\n";
else if (months == 2)
cout << "February.\n";
else if (months == 3)
cout << "March.\n";
ECT
我试图将其发送到每个if语句将用一个月的名称而不是数字的位置。然而它只是继续循环&#34;请输入&#34;的总降雨量。 12次。
答案 0 :(得分:3)
因为你错过了{}
个大括号。使用:
for (months = 1; months <= 12; months ++)
{
}