用指针法实现输入3个字符串,按由小到大顺序输出。#include \"stdio.h\"
#include \"string.h\" int main() {char *t;
char *p1=NULL,*p2=NULL,*p3=NULL; char ch1[20]={0},ch2[20]={0},ch3[20]={0}; p1=ch1; p2=ch2; p3=ch3; printf(\"No1:\"); scanf(\"%s\printf(\"No2:\"); scanf(\"%s\printf(\"No3:\"); scanf(\"%s\if(strcmp(p1,p2)>0) {t=p1;p1=p2;p2=t;} if(strcmp(p1,p3)>0) {t=p1;p1=p3;p3=t;} if(strcmp(p2,p3)>0) {t=p2;p2=p3;p3=t;}
printf(\"%s\\n%s\\n%s\\n\return 0; }
因篇幅问题不能全部显示,请点此查看更多更全内容