#include <stdio.h> int main(void) { char a[3][4],tmp[4]; int i,j; scanf("%s%s%s", a[0], a[1], a[2]) ; for(i=0;i<3-1;i++) { for(j=i+1;j<3;j++) { if(a[i][0] > a[j][0]) { tmp=a[i]; a[i]=a[j]; a[j]=tmp; } if(a[i][0] == a[j][0]) { if(a[i][1]>a[j][1]) { tmp=a[i]; a[i]=a[j]; a[j]=tmp; } } if(a[i][1] == a[j][1]) { if(a[i][2]>a[j][2]) { tmp=a[i]; a[i]=a[j]; a[j]=tmp; } } } } printf("%c%c%c\n", a[0][0], a[0][1], a[0][2]); printf("%c%c%c\n", a[1][0], a[1][1], a[1][2]); printf("%c%c%c\n", a[2][0], a[2][1], a[2][2]); return 0; } /* Main.c: In function 'main': Main.c:15:9: error: assignment to expression with array type tmp=a[i]; ^ Main.c:16:10: error: assignment to expression with array type a[i]=a[j]; ^ Main.c:17:10: error: assignment to expression with array type a[j]=tmp; ^ Main.c:23:10: error: assignment to expression with array type tmp=a[i]; ^ Main.c:24:11: error: assignment to expression with array type a[i]=a[j]; ^ Main.c:25:11: error: assignment to expression with array type a[j]=tmp; ^ Main.c:32:10: error: assignment to expression with array type tmp=a[i]; ^ Main.c:33:11: error: assignment to expression with array type a[i]=a[j]; ^ Main.c:34:11: error: assignment to expression with array type a[j]=tmp; ^ */ |
Double click to view unformatted code.