user-0 提问: c语言的问题，想了好久

回复:
user: user-1
content: 楼主想问一下怎么提问呢/

user: user-0
content: 引用 1 楼 曹佑之的回复:#include <stdio.h>  #define MAX 10  int main() { 	int arr[MAX]; 	int  i = 0; 	int j = 0; 	int temp = 0; 	int key = 0;  	printf("please input the %d number:", MAX); 	for(i = 0; i < MAX; i++){ 		scanf("%d", &arr[i]); 	}  	while(1){ 		printf("please input your key(1/2/3):"); 		scanf("%d", &key); 		if(key >= 1 && key <= 3){ 			break; 		} 	} 	 	switch(key){ 	case 1 :  		for(i = 0; i < MAX - 1; i++){ 			for(j = 0; j < MAX - i - 1; j++){ 				if(arr[j] < arr[j + 1]){ 				temp = arr[j]; 				arr[j] = arr[j + 1]; 				arr[j + 1] =temp; 				} 			} 		} 		for(i = 0; i < MAX; i++){ 		printf("%4d", arr[i]); 		} 		printf("\n");  		break; 	case 2 : 		for(i = 0; i < MAX - 1; i++){ 			for(j = 0; j < MAX - i - 1; j++){ 				if(arr[j] > arr[j + 1]){ 				temp = arr[j]; 				arr[j] = arr[j + 1]; 				arr[j + 1] =temp; 				} 			} 		} 		for(i = 0; i < MAX; i++){ 			printf("%4d", arr[i]); 		} 		printf("\n"); 		break; 	case 3 : 		for(i = 0; i < MAX; i++){ 			printf("%4d", arr[i]); 		} 		printf("\n"); 		break; 	} 	return 0; }//请参考 谢谢哥，我试试，啦啦啦

user: user-0
content: 引用 1 楼 曹佑之的回复:#include <stdio.h>  #define MAX 10  int main() { 	int arr[MAX]; 	int  i = 0; 	int j = 0; 	int temp = 0; 	int key = 0;  	printf("please input the %d number:", MAX); 	for(i = 0; i < MAX; i++){ 		scanf("%d", &arr[i]); 	}  	while(1){ 		printf("please input your key(1/2/3):"); 		scanf("%d", &key); 		if(key >= 1 && key <= 3){ 			break; 		} 	} 	 	switch(key){ 	case 1 :  		for(i = 0; i < MAX - 1; i++){ 			for(j = 0; j < MAX - i - 1; j++){ 				if(arr[j] < arr[j + 1]){ 				temp = arr[j]; 				arr[j] = arr[j + 1]; 				arr[j + 1] =temp; 				} 			} 		} 		for(i = 0; i < MAX; i++){ 		printf("%4d", arr[i]); 		} 		printf("\n");  		break; 	case 2 : 		for(i = 0; i < MAX - 1; i++){ 			for(j = 0; j < MAX - i - 1; j++){ 				if(arr[j] > arr[j + 1]){ 				temp = arr[j]; 				arr[j] = arr[j + 1]; 				arr[j + 1] =temp; 				} 			} 		} 		for(i = 0; i < MAX; i++){ 			printf("%4d", arr[i]); 		} 		printf("\n"); 		break; 	case 3 : 		for(i = 0; i < MAX; i++){ 			printf("%4d", arr[i]); 		} 		printf("\n"); 		break; 	} 	return 0; }//请参考 谢谢哥，我试试，

user: user-2
content: #include <stdio.h>  #define MAX 10  int main() { 	int arr[MAX]; 	int  i = 0; 	int j = 0; 	int temp = 0; 	int key = 0;  	printf("please input the %d number:", MAX); 	for(i = 0; i < MAX; i++){ 		scanf("%d", &arr[i]); 	}  	while(1){ 		printf("please input your key(1/2/3):"); 		scanf("%d", &key); 		if(key >= 1 && key <= 3){ 			break; 		} 	} 	 	switch(key){ 	case 1 :  		for(i = 0; i < MAX - 1; i++){ 			for(j = 0; j < MAX - i - 1; j++){ 				if(arr[j] < arr[j + 1]){ 				temp = arr[j]; 				arr[j] = arr[j + 1]; 				arr[j + 1] =temp; 				} 			} 		} 		for(i = 0; i < MAX; i++){ 		printf("%4d", arr[i]); 		} 		printf("\n");  		break; 	case 2 : 		for(i = 0; i < MAX - 1; i++){ 			for(j = 0; j < MAX - i - 1; j++){ 				if(arr[j] > arr[j + 1]){ 				temp = arr[j]; 				arr[j] = arr[j + 1]; 				arr[j + 1] =temp; 				} 			} 		} 		for(i = 0; i < MAX; i++){ 			printf("%4d", arr[i]); 		} 		printf("\n"); 		break; 	case 3 : 		for(i = 0; i < MAX; i++){ 			printf("%4d", arr[i]); 		} 		printf("\n"); 		break; 	} 	return 0; }//请参考