📄 totalsale.cpp
字号:
#include <iostream>
using namespace std; //introduces namespace std
const int MONTHS = 12;
const char * months[MONTHS] = {"January", "February", "March", "April",
"May", "June", "July", "August", "September",
"October", "November", "December"};
int main()
{
int sales[MONTHS];
int month;
cout << "Enter the monthly sales for \"C++ for Fools\":\n";
for (month = 0; month < MONTHS; month++)
{
cout << "Sales for " << months[month] << ": ";
cin >> sales[month];
}
double total = 0.0;
for (month = 0; month < MONTHS; month++)
total += sales[month];
cout << "Total sales: " << total << endl;
system("Pause");
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -