2007/04/30 | 又换了一种方法写排列2个数的大小
类别(计算机与编程) | 评论(0) | 阅读(15) | 发表于 16:15

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

}

0

评论Comments

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