酷代码 AI
菜单
服务商

C语言:利用函数实现输入三个整数并从大到小排序输出

```c #include <stdio.h> // 输入函数 void input(int *a, int *b, int *c) { scanf("%d%d%d", a, b, c); } // 排序函数 void sort(int *a, int *b, int *c) { int temp; if (*a < *b) { temp = *a; *a = *b; *b = temp; } if (*a < *c) { temp = *a; *a = *c; *c = temp; } if (*b < *c) { temp = *b; *b = *c; *c = temp; } } int main() { int a, b, c; input(&a, &b, &c); sort(&a, &b, &c); printf("%3d%3d%3d\n", a, b, c); return 0; } ``` ######[AI写代码神器 | 246点数解答 | 2024-10-22 22:06:20]

相关提问
本站限时免费提问中
实用工具查看更多
Linux在线手册 [开发类]
Jquery在线手册 [开发类]
今日油价 [生活类]
图片互转base64 [开发类]
时间转换器 [开发类]