Description
Enter the names and scores of 10 students on the keyboard. Sort the names of the Students in lexicographically Ascending Order and output the results (the relationship between the names and scores remains unchanged ).
Input
Enter 11 rows in total. Each row in the first 10 rows is the name of a student, and the last row is 10 integers separated by spaces to indicate the corresponding scores of 10 students.
The output table lists the students' names and scores in Lexicographic Order. There are 10 rows in total. Each student's name and score occupies one row. The names and scores are separated by commas. Sample Input
BushWhiteMarkJeanBlackWoodJennyFrankBillSmith78 85 96 65 46 83 77 88 54 98
Sample output
Bill,54Black,46Bush,78Frank,88Jean,65Jenny,77Mark,96Smith,98White,85Wood,83
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# Include <stdio. h>
# Include <string. h>
Int main ()
{
Char a [11] [1, 120], B [2, 120];
Int q [10], p, w;
For (w = 0; w <10; w ++)
{
Gets (a [w]);
}
For (int w = 0; w <10; w ++)
{
Scanf ("% d", & q [w]);
}
For (int y = 0; y <10; y ++)
For (w = 1; w <10; w ++)
{
If (strcmp (a [W-1], a [w])> 0)
{
Strcpy (B, a [W-1]);
Strcpy (a [W-1], a [w]);
Strcpy (a [w], B );
P = q [w];
Q [w] = q [W-1];
Q [W-1] = p;
}
}
For (w = 0; w <10; w ++)
Printf ("% s, % d \ n", a [w], q [w]);
Return 0;
}