回复8楼:C++中 大写的字母和小写字母是不一样的,算是2个不同的变量
#include <iostream>
using namespace std;
const int Years=3;
const int Months=12;
int main()
{
int years,months;
int xs[Years][Months]={0};
long int book1=0;
long int book2=0;
long int book3=0;
long int books=0;
for(years=0;years<Years;years++)
{
for(months=0;months<Months;months++)
{
cout<<"请输入第"<<years+1<<"年第"<<months+1<<"月的销售量";
cin>>xs[years][months];
fflush(stdin);
switch(years)
{
case 0:
book1=book1+xs[0][months];
break;
case 1:
book2=book2+xs[1][months];
break;
case 2:
book3=book3+xs[2][months];
break;
}
books=book1+book2+book3;
}
}
cout<<"第一年的销售量是:"<< book1;
cout<<"第二年的销售量是:"<< book2;
cout<<"第三年的销售量是:"<< book3;
cout<<"三年总的销售量是:"<<books;
system("pause");
return 0;
}