又换了一种方法写排列2个数的大小

      计算机与编程 2007-4-30 16:15:00

#include <iostream.h>

main ()

{
cout<<endl;
cout<<"====================="<<endl;
cout<<"please input 2 nums: "<<endl;
cout<<endl;
cout<<"please input the x.value:"<<endl;
int x,y;
cin>>x;
cout<<"please input the y.value:"<<endl;
cin>>y;

int big,small;
if (x>y) big=x,small=y;
else if (x<y) big=y,small=x;
else if (x=y) big=x,small=y;

cout<<endl;

cout<<x<<", "<<y<<", "<<big<<", "<<small<<", "<<endl;

if (big==small)
 cout<<"big = small = : "<<x<<endl;
else
 cout<<"the big = : "<<big<<endl<<"the small = : "<<small<<endl;

  return 0;

}

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

回复Comments

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