| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3700 人关注过本帖
标题:[求助]输入3个数,要求按由小到大的顺序输出
只看楼主 加入收藏
西部天狼
Rank: 1
等 级:新手上路
帖 子:95
专家分:0
注 册:2006-2-23
收藏
得分:0 
楼主,这三个程序写的比较粗,但我觉得基本意思到了,还满意吗?
第3题其实就是个排序问题。
第2题的提示的确有些劣,提示让人用什么语句写程序真是不好。
第1题类似一个简单的推理机,这样的题多做些很实用。

学习-->编程-->交流-->再学习-->再编程-->再交流
2006-03-07 15:31
olivezhang
Rank: 1
等 级:新手上路
帖 子:223
专家分:0
注 册:2005-9-14
收藏
得分:0 

写了个一句话比较三个数大小:
#include <IOSTREAM>
using namespace std;

int main(int argc, char* argv[])
{
int a[3];
cout << "Please input the first data: ";
cin >> a[0];
cout << "Please input the second data: ";
cin >> a[1];
cout << "Please input the third data: ";
cin >> a[2];

int max = 0;
max = a[0] > a[1]? (a[0] > a[2]? a[0] : a[2]) : (a[1] > a[2]? a[1] : a[2]);
cout << "the max data is: " << max << endl;

system("pause");
return 0;
}


谷底深深行 ,峰顶漫漫步......@_@
2006-03-07 15:59
快速回复:[求助]输入3个数,要求按由小到大的顺序输出
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017200 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved