c++高手如

来源:百度知道 编辑:UC知道 时间:2024/06/01 08:59:06
1.输入一个两位数,把它转换成英文单词输出,如12输出one two。
2.输入0到6,换成星期值,如输入3,输出“today is Wed” 如果不合法,输出“I don’t know what you mean!”
3.输入年份和月份,输出该年中该月的天数。
下个星期考试,各位大虾帮我一下,我感激不敬!!!

1
#include <iostream>
using namespace std;
int main()
{
char s[][6]={"zero","one","two","three","four","five","six","seven","eight","nine"};
int a;
cin>>a;
cout<<s[a/10]<<s[a%10]<<endl;
return 1;
}

2
#include <iostream>
using namespace std;
int main()
{
char s[][4]={"sun","mon","teu","wed","thu","fri","sat"};
int a;
cin>>a;
if(a<0||a>6)cout<<"error\n";
else cout<<s[a]<<endl;
return 1;
}

3
#include <iostream>
using namespace std;

bool isleap(int year)
{
if(year%4!=0)return false;
if(year%100 == 0 && year%400 != 0)return false;
return true;
}