判断4个数字中谁最大的一段代码,不过IF的用法比较呆板

      计算机与编程 2007-4-25 15:01:00

//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;

}

标签集:TAGS:
回复Comments() 点击Count()
喜欢就顶一下

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}