杭电OJ 2000题 题目见正文
题目:提交之后 提示我wrong answer 求助!!!!!!!!!!
程序代码:
#include"iostream" using namespace std; void sort(char *_temp, int length); int main() { char arr[3][3]; int i; for (i = 0; i < 3; i++) { cin >> arr[i][0] >> arr[i][1] >> arr[i][2]; sort(arr[i], 3); } for (i = 0; i < 3; i++) { cout << arr[i][0] <<" "<< arr[i][1] <<" "<< arr[i][2]<<endl; } } void sort(char *_temp, int length) { int i, j; char cup; for (i = 1; i < length;i++) for (j = 1; j <= length - i; j++) if (_temp[j - 1]>_temp[j]) { cup = _temp[j - 1]; _temp[j - 1] = _temp[j]; _temp[j] = cup; } }