Home > Back-end >  Big help on error code
Big help on error code

Time:06-11

#include
#include

Int main ()
{
Int x [5]=,8,9,1,2 {4};
Char name [5] [80]={" zhang ", "hei", "haha", "asas", "qwe"};
Char copy [80].
int i=0;
int n;
Int Max;
/* for (I=0; i<5; I++) {
Printf (" input the name: ");
The scanf (" % s ", & amp; The name [I]);
Printf (" input the score: ");
The scanf (" % d ", & amp; X [I]);
} */
While (i<5) {
Max=I;
For (n=I; N<5; N++) {
If (x (Max) & gt; [n]) {x
Max=Max;
} else {
Max=n;
}
}
//printf (" % d ", Max);
N=x [I];
[I]=x x (Max);
X (Max)=n;
Strcpy (copy, name (Max));
Strcpy (name (Max), the name [I]);
Strcpy (name [I], copy);
i++;
}
For (n=0; N<5; N++) {
Printf (" % s % d \ n, "the name [n], [n] x);
}
return 0;
}




This code if their input is not sorted, but defined in advance can sort, beg you,

CodePudding user response:

I'm sorry, I wrong, you cycle, after I return to zero again

CodePudding user response:

for(i=0; i<5; I++) {
Printf (" input the name: ");
The scanf (" % s ", & amp; The name [I]);
Printf (" input the score: ");
The scanf (" % d ", & amp; X [I]);
}
I have been here 5, so the following loop into don't go, again can be set to 0
Increase I=0;
While (i<5) {
.

CodePudding user response:

The name [5] [80]
The name [80] [5]
Who is really?

CodePudding user response:

refer to the second floor qq_45798109 response:
, I'm sorry, but I'm wrong and you cycle, after I back to zero

Ok, thank you, that should be how to input Chinese character name, please

CodePudding user response:

reference 5 floor qq_45850659 reply:
Quote: refer to the second floor qq_45798109 response:
, I'm sorry, but I'm wrong and you cycle, after I back to zero

Ok, thanks, could you tell me that should be how to input Chinese characters name?

Chinese language, a word of two characters

CodePudding user response:

refer to 6th floor qq_45798109 response:
Quote: refer to the 5 floor qq_45850659 response:
Quote: refer to the second floor qq_45798109 response:
, I'm sorry, but I'm wrong and you cycle, after I back to zero

Ok, thanks, could you tell me that should be how to input Chinese characters name?

In Chinese, a word of two characters

I don't know how to input, should not every char type is only one character at a time

CodePudding user response:

refer to 7th floor qq_45850659 response:
Quote: refer to the sixth floor qq_45798109 response:
Quote: refer to the fifth floor qq_45850659 reply:
Quote: refer to the second floor qq_45798109 response:
, I'm sorry, but I wrong, you cycle, after I back to zero

Ok, thanks, could you tell me that should be how to input Chinese characters name?

In Chinese, a word of two characters

I don't know how to input, each one char type is not only a character?

Direct input, run out on my side of the

CodePudding user response:

Thank you, I also run out, when I used input it will dance steps, may be useless # include< before; String> This!

CodePudding user response:

refer to the eighth floor qq_45798109 response:
Quote: refer to 7th floor qq_45850659 response:

Quote: refer to the sixth floor qq_45798109 response:
Quote: refer to the 5 floor qq_45850659 response:
Quote: refer to the second floor qq_45798109 response:
, I'm sorry, but I'm wrong and you cycle, after I back to zero

Ok, thanks, could you tell me that should be how to input Chinese characters name?

In Chinese, a word of two characters

I don't know how to input, each one char type is not only a character?

Direct input, run out on my side of the

Thank you, I also run out, when I used input it will dance steps, may be useless # include< before; String> This!

CodePudding user response:

 # include 
#include

Int main ()
{
Int x [5]=,8,9,1,2 {4};
Char name [5] [80]={" zhang ", "hei", "haha", "asas", "qwe"};
Char copy [80].
int i=0;
Int n, TMP;
Int Max;
/* for (I=0; i<5; I++) {
Printf (" input the name: ");
The scanf (" % s ", & amp; The name [I]);
Printf (" input the score: ");
The scanf (" % d ", & amp; X [I]);
} */
While (i<5) {
Max=I;
For (n=I; N<5; N++) {
If (x [Max] <[n]) {x
Max=n;
/*
If (x (Max) & gt; [n]) {x
//Max=Max;
} else {
Max=n;
}
*/
}
//printf (" % d ", Max);
//
if (max ! I)={
TMP=x [I];
[I]=x x (Max);
X (Max)=TMP;
Strcpy (copy, name (Max));
Strcpy (name (Max), the name [I]);
Strcpy (name [I], copy);
}
}
i++;
}
For (n=0; N<5; N++) {
Printf (" % s % d \ n, "the name [n], [n] x);
}
return 0;
}

For your reference ~
Sort of the building Lord ~ if you have any questions

CodePudding user response:

 # include 
#include

Int main ()
{
Int x [5]=,8,9,1,2 {4}, TMP.
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related