map容器——输入数字输出对应的星期程序
#include <iostream>
#include<map>
#include<string>
using namespace std;
int main()
{
map<int,string>a;
string str[]={"Monday","Tuesday","Wednesday","Thusday","Friday","Saterday","Sunday"};
int i;
for(i=0;i<7;i++)
{
a.insert({i+1,str[i]});
}
while(cin>>i)
{
cout<<a[i]<<'\n';
}
}