没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
判断输入是否合理
#include <iostream.h>
void main()
{
unsigned int age;
cout <<"what is the student's age...";
cin >> age;
if (age<10)
cout << "the age may be wrong";
}
判断是否为闰年
#include <iostream.h>
void main()
{
int year;
cout << "please input a year...";
cin >> year;
if (year %4==0 && year % 100 !=0 || year % 400 == 0)
cout << "The year is leap year ";
else
cout << "The year isn't leap year ";
}
输入两个整数,判断大小:
#include <iostream.h>
void main()
#include <iostream.h>
void main()
{
unsigned int age;
cout <<"what is the student's age...";
cin >> age;
if (age<10)
cout << "the age may be wrong";
}
判断是否为闰年
#include <iostream.h>
void main()
{
int year;
cout << "please input a year...";
cin >> year;
if (year %4==0 && year % 100 !=0 || year % 400 == 0)
cout << "The year is leap year ";
else
cout << "The year isn't leap year ";
}
输入两个整数,判断大小:
#include <iostream.h>
void main()
{
int x,y;
cout << "Enter x and y:";
cin>>x>>y;
if (x!=y)
if (x>y)
cout << "x>y"<<endl;
else
cout << "x<y" <<endl;
else
cout << "x=y" << endl;
}
求三个数中的最大数:
方法一:
#include <iostream.h>
void main()
{
int x,y,z;
cin >>x>>y>>z;
int max=x;
if (z>y)
{
if (z>x)
max=z;
}
else
{
if (y>x)
max=y;
int x,y;
cout << "Enter x and y:";
cin>>x>>y;
if (x!=y)
if (x>y)
cout << "x>y"<<endl;
else
cout << "x<y" <<endl;
else
cout << "x=y" << endl;
}
求三个数中的最大数:
方法一:
#include <iostream.h>
void main()
{
int x,y,z;
cin >>x>>y>>z;
int max=x;
if (z>y)
{
if (z>x)
max=z;
}
else
{
if (y>x)
max=y;
剩余9页未读,继续阅读
资源评论
venus916
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功