You are on page 1of 1

#include <iostream>

#include <string>

using namespace std;

int main()
{
cout << "Hello world!" << endl;
string month[12]={"january", "february", "march", "april", "may", "june",
"july", "august", "september", "october", "november", "december"};
int id[12]={1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
double rain[12];
for (int i=0; i<12; i++)
{
cin>>rain[i];
}
int s, mi, mv, tempid;
for (s=0; s<11; s++)
{
mi=s;
mv=rain[s];
for (int i=s+1; i<11; i++)
{
if (rain[i]>mv)
{
mv=rain[i];
mi=i;
tempid=i+1;
}
}
rain[mi]=rain[s];
rain[s]=mv;
id [mi]=id[s];
id [s]=tempid;
}
for (int i=0; i<12; i++)
{
cout<<month[id[i]-1]<<", ";
}
return 0;
}

You might also like