C++编程 星期转换
题目内容:将用户输入的阿拉伯数字转换成对应星期几的英文单词(monday,tuesday,wednesday,thursday,friday,saturday,sunda...
题目内容:
将用户输入的阿拉伯数字转换成对应星期几的英文单词(monday,tuesday,wednesday,thursday,friday,saturday,sunday)。如果用户输入的数字不在1~7之间,显示信息:invalid 展开
将用户输入的阿拉伯数字转换成对应星期几的英文单词(monday,tuesday,wednesday,thursday,friday,saturday,sunday)。如果用户输入的数字不在1~7之间,显示信息:invalid 展开
2个回答
展开全部
#include <iostream>
using namespace std;
//by:@qwn3213
int main()
{
char xq[][10]={"x","monday","tuesday","wednesday","thursday","friday","saturday","sunday"};
int n;
cin>>n;
if(n>7||n<1) cout<<"invalid";
else
cout<<xq[n];
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询