第一章第十二题
来源:互联网 发布:c语言编程杨辉三角 编辑:程序博客网 时间:2024/06/07 20:20
#include <iostream>using namespace std;int main(){long a[5]={456465,-5546.1198783,1654,-356};int b[5]={2,5,8,4,6};float c[5]={2.4,1.5,3.6,2.8,4.8};void sort(long[]);sort(a);void sort(int[]);sort(b);void sort(float[]);sort(c);return 0;}void sort(long a[]){ int i,j; long t; for(j=0;j<5;j++) for(i=0;i<5-j;i++) if(a[i]>a[i+1]) { t=a[i]; a[i]=a[i+1]; a[i+1]=t; } cout<<"The sorted numbers:"<<endl; for(i=0;i<5;i++) cout<<a[i]<<" "<<endl;}void sort(int b[]){ int i,j; int t; for(j=0;j<5;j++) for(i=0;i<5-j;i++) if(b[i]>b[i+1]) { t=b[i]; b[i]=b[i+1]; b[i+1]=t; } cout<<"The sorted numbers:"<<endl; for(i=0;i<5;i++) cout<<b[i]<<" "<<endl;}void sort(float c[]){ int i,j; float t; for(j=0;j<5;j++) for(i=0;i<5-j;i++) if(c[i]>c[i+1]) { t=c[i]; c[i]=c[i+1]; c[i+1]=t; } cout<<"The sorted numbers:"<<endl; for(i=0;i<5;i++) cout<<c[i]<<" "<<endl;}
0 0
- 第一章第十二题
- 第一章第十二题
- 第一章第十二题
- 第一章 第十二节 总结
- 第十二题
- 第十二题
- 第十二题
- 第十二题(线程)
- P051第十二题
- C++第十二题20150330
- 第二章第十二题
- 第二章第十二题
- 第二章第十二题
- 第十二题(线程)
- 第三章第十二题
- 第十二题 P035
- 专题三 第十二题
- 第十二章课后题
- OpenCMS环境的搭建
- 调用OpenCV静态库
- 第14题
- 哈理工2249开锁魔法 概率dp
- Java多线程如何实现资源共享
- 第一章第十二题
- 版本管理
- compromise
- POJ1743——不可重迭的最长重复子串
- JavaSE之压缩zip文件
- ios-day23-01(ios开发之文件下载)
- 2.用户模块:注册页面JS前台校验.
- 第一章第十四提
- C++运算符重载函数作为类成员函数和友元函数