码迷,mamicode.com
首页 > 其他好文 > 详细

第一章 课后习题 10

时间:2017-09-10 15:04:21      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:log   else   logs   turn   color   第一章   clu   sort   std   

 1 #include <iostream>
 2 using namespace std;
 3 int main()
 4 { void sort(int x,int y,int z);
 5   int x,y,z;
 6   cin>>x>>y>>z;
 7   sort(x,y,z);
 8   return 0;
 9 }
10 void sort(int x,int y,int z)
11 {
12   int temp;
13   if(x>y) {temp=x;x=y;y=temp;}   //{ }内3个语句的作用是将x和y的值互换)
14   if(z<x) cout<<z<<,<<x<<,<<y<<endl;
15     else if (z<y) cout<<x<<,<<z<<,<<y<<endl;
16       else cout<<x<<,<<y<<,<<z<<endl;

 

第一章 课后习题 10

标签:log   else   logs   turn   color   第一章   clu   sort   std   

原文地址:http://www.cnblogs.com/Dragonliuoumai/p/7501042.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!