#include<iostream>
const int MONTHS = 12;
const char * months[MONTHS] = {"1","2","3","4","5","6","7","8","9","10","11","12"};
// 主要是用来熟悉一下 const 用法 罢了;
int main()
{
using namespace std;
int sales[MONTHS],sum = 0;
for(int i = 0; i < MONTHS; i++)
{
cout << "请输入在"<< months[i] <<" 的c ++ FOR xx 的销售量 : ";
cin >> sales[i];
sum += sales[i];
}
cout << "这一年 c++ 的销售额是 : " << sum << endl;
return 0;
}
循环第五题
最新推荐文章于 2022-10-15 21:39:40 发布