Transcript with name

Source: Internet
Author: User

[Cpp]
/*
* Copyright and version Declaration of the program
* Copyright (c) 2012, a student from the computer College of Yantai University
* All rightsreserved.
* File name: array. cpp
* Author: Yang shaoning
* Completion date: January 1, December 8, 2012
* Version: v1.0
*
* Input Description: None
* Problem description: Define an array and output the result in the order of scores.
*/
# Include <iostream>
# Include <string>
# Include <iomanip>
Using namespace std;
Int main ()
{
Int I, j, k;
String n;
Float score [6] = {98,76, 88,90, 91,85 };
String name [6] = {"yang", "li", "liu", "tian", "zhang", "xu "};
For (I = 0; I <5; ++ I)
For (j = 0; j <5-i; ++ j)
{
If (score [j]> score [j + 1])
{
K = score [j];
Score [j] = score [j + 1];
Score [j + 1] = k;
N = name [j];
Name [j] = name [j + 1];
Name [j + 1] = n;
}
}
For (j = 0; j <6; ++ j)
Cout <name [j] <setw (5) <score [j] <endl;
Return 0;
}

Result:

Result: Come on !!!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.