解题思路:用sort函数进行排列(默认从小到大)
注意事项:需要用到头文件#include <algorithm>和using namespace std;
参考代码:
#include <stdio.h>
#include <algorithm>
using namespace std;
int main()
{
int a[4];
for(int i=0;i<4;i++)
scanf("%d",&a[i]);
sort(a,a+4);
for(int i=0;i<4;i++)
printf("%d ",a[i]);
return 0;
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题6.7 (C语言代码)浏览:645 |
简单的a+b (C语言代码)浏览:548 |
简单的a+b (C语言代码)浏览:542 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:516 |
不会做的浏览:874 |
字符串比较 (C语言代码)答案错误????浏览:597 |
printf基础练习2 (有点不明白)浏览:844 |
WU-拆分位数 (C++代码)浏览:784 |
剪刀石头布 (C语言代码)浏览:752 |
1157题解浏览:715 |