💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
>[info]输入3个数a,b,c,按大小顺序输出。 程序分析:利用指针方法。 ~~~C #include <stdio.h> void swap(int *,int *); int main(){ int a,b,c; int *p1, *p2, *p3; printf("请输入三个数字:\n"); scanf("%d %d %d", &a, &b, &c); p1 = &a; p2 = &b; p3 = &c; if(a>b) swap(p1,p2); if(a>c) swap(p1,p3); if(b>c) swap(p2,p3); printf("%d %d %d\n", a, b, c); return 0; } void swap(int *s1, int *s2){ int t; t = *s1; *s1= *s2; *s2 = t; } ~~~