#include <iostream>
using namespace std;
int main()
{
const char *y_mouth[3][12]= //若去掉const g++会有waring vs2008却没有
{
{"1-1","1-2","1-3","1-4","1-5","1-6","1-7","1-8","1-9","1-10","1-11","1-12"},
{"2-1","2-2","2-3","2-4","2-5","2-6","2-7","2-8","2-9","2-10","2-11","2-12"},
{"3-1","3-2","3-3","3-4","3-5","3-6","3-7","3-8","3-9","3-10","3-11","3-12"}
};
int num = 0,y_sum = 0,t_sum = 0;
for(int a = 0;a<3;a++)
{
for(int b = 0;b<12;b++)
{
cout << y_mouth[a][b] << " : ";
cin >> num;
y_sum += num;
}
cout << "y_sum" << a+1 << "year : " << y_sum << endl;
t_sum+=y_sum;
y_sum = 0;
}
cout << "t_sum = " << t_sum << endl;
return 0;
}
c++ primer plus 第五章编程练习
最新推荐文章于 2022-04-09 22:05:56 发布