输入三个整数,将他们排序然后输出中间那个数
2015-08-27 11:15
162 查看
#include<iostream>
using namespace std;
int main()
{
void sort(int x,int y,int z);
int a,b,c;
cin>>a>>b>>c;
sort(a,b,c);
return 0;
}
void sort(int x,int y,int z)
{
int temp;
if(x>y){temp=x;x=y;y=temp;}
if(z<x) cout<<x<<endl;
else if(z<y) cout<<z<<endl;
else cout<<y<<endl;
}
using namespace std;
int main()
{
void sort(int x,int y,int z);
int a,b,c;
cin>>a>>b>>c;
sort(a,b,c);
return 0;
}
void sort(int x,int y,int z)
{
int temp;
if(x>y){temp=x;x=y;y=temp;}
if(z<x) cout<<x<<endl;
else if(z<y) cout<<z<<endl;
else cout<<y<<endl;
}
相关文章推荐
- iOS开发UI篇—程序启动原理和UIApplication
- 责任链模式
- 通过颜色创建image图片
- Euro Efficiency(完全背包)
- spring mvc task:scheduled cron配置
- leetcode Longest Palindromic Substring
- Android 在一个程序中启动另一个程序
- MTK G-sensor
- 设计模式——组合模式
- eclipse生成可执行jar包
- ConcurrentHashMap 高并发性的实现机制
- 虚拟化的最后一公里–虚拟化网卡
- 关于属性,成员变量的认识
- [CareerCup] 6.5 Drop Eggs 扔鸡蛋问题
- 模板模式
- 移动端点击、触碰
- 领域模型驱动设计(Domain Driven Design)入门概述
- android pcm
- 我的第一篇博客
- Leetcode #237 Delete Node in a Linked List