1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#include <iostream>
#include <utility>
using namespace std;
int main()
{
double Annual=0;
pair<string,int> p[]={
make_pair("January",0),
make_pair("February",0),
make_pair("March",0),
make_pair("April",0),
make_pair("May",0),
make_pair("June",0),
make_pair("July",0),
make_pair("August",0),
make_pair("September",0),
make_pair("October",0),
make_pair("November",0),
make_pair("December",0)
};
for(int i=0;i<12;i++)
{
cin>>p[i].second;//this your monthly mileage for each month
Annual+=p[i].second;
}
return 0;
}
|