四题都要做????
第一题:
#include<bits/stdc++.h>
using namespace std;
int main()
{
char temp;
cin>>temp;
if(temp>='a'&&temp<='z')
cout<<"小写字母";
else if(temp>='A'&&temp<='Z')
cout<<"大写字母";
else if(temp>='0'&&temp<='9')
cout<<"数字";
else
cout<<"其他字符";
return 0;
}
第二题:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a;
cin>>a;
if(a>=2&&a<=6)
{
cout<<"这个小朋友入托了"<<endl;
if(a<=3)
{
cout<<"他是小班的";
}
else if(a==4)
{
cout<<"他是中班的";
}
else
{
cout<<"他是大班的";
}
}
else
{
cout<<"这个小朋友没有入托,一个班都没有";
}
}
第三题:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int year, month;
printf("输入年和月(用空格分隔):\n");
scanf("%d %d", &year, &month);
switch (month)
{
case 2:if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
printf("29天!\n");
else
printf("28天!\n");
break;
case 4:
case 6:
case 9:
case 11:printf("30天!\n"); break;
default:printf("31天!\n"); break;
}
return 0;
}
第四题:
#include<stdio.h>
using namespace std;
int main()
{
double a,b,c;
scanf("%f%f%f",&a,&b,&c);
if(a+b>c&&a+c>b&&b+c>a)
printf("可以构成三角形\n");
else printf("不能构成三角形\n");
return 0;
}