2007/04/25 | 判断4个数字中谁最大的一段代码,不过IF的用法比较呆板
类别(计算机与编程) | 评论(0) | 阅读(8) | 发表于 15:01

//2002.09.04.this programme shows how to estimate if a num is a negative and which num is big...

#include <iostream.h>

main()
{
cout<<endl;
cout<<"#####################"<<endl;
cout<<""<<endl;
cout<<"please input 4 nums: "<<endl;
cout<<endl;

long int a,b,c,d;
cout<<"please input a.value: "<<endl;
cin>>a;
cout<<"please input b.value: "<<endl;
cin>>b;
cout<<"please input c.value: "<<endl;
cin>>c;
cout<<"please input d.value: "<<endl;
cin>>d;
cout<<endl;

if (a<b)
{a=b;}
if (a<c)
{a=c;}
if (a<d)
{a=d;}

//else z=c;
//else z=b;
cout<<endl;
cout<<"the big num is: "<<a<<endl;

cout<<endl;
cout<<"do you want to exit?"<<endl;
char cc;
cin>>cc;

return 0;

}

0

评论Comments

日志分类
首页[666]
计算机与编程[133]
EMU[40]
UFOs[24]
房产[127]
音乐[13]
LOG[0]
经济[120]
影视[3]
物理[7]
数学[8]
社会[105]
职场[9]
生物医学[18]
生活[59]