14th Week Project 3-multi-academic Transcripts 2

Source: Internet
Author: User
/* *copyright (c) 2014, Yantai University School of computer
*all rights reserved.
* File name: Test.cpp
* Author: Chow
* Completion Date: November 27, 2014
* Version Number: v1.0
*
* Problem Description: A class of not more than 100 students, with a two-dimensional array score[][4] Save the students of the high number, English, C + + scores and total score (this assumes that the student's number is the continuous value of shaping, with the array of row subscript for the number). On this basis, to complete the corresponding requirements;
* Program Input: Enter the number of students, student Guangzi results, student names;
* Program output: Output the highest score of each course and total score, the lowest score, the average score and the name of the student who obtained the highest achievement;



</pre><pre class= "cpp" name= "code" > #include <iostream> #include <string> using namespace std;

void input (double s[][4],int n);

void input (string name[],int n);

void output (double s[][4],int n);

Double Max (double s[][4],int n,int i);

Double min (double s[][4],int n,int i);

Double avg (double s[][4],int n,int i);
    int main () {int i,j,num;
    string temp;
    Double score[100][4];
    String name[100],course[4]= {"Advanced mathematics", "English", "C + +", "Total Score"};
    cout<< "Enter the number of students:";
    cin>>num;
    cout<< "Please enter student's name:";
    Input (Name,num);
    Input (Score,num);
    Output (Score,num);
        for (i=0; i<4; i++) {cout<<course[i]<< "the highest score is" <<max (score,num,i) << ",";
        cout<< "The lowest score is" <<min (score,num,i) << ",";
        cout<< "Average score is" <<avg (score,num,i) << ","; for (j=0; j<num; J + +) {if (Score[j][i]==max (score,num,i)) cout<< "Get the list of top students:" <<name[j]<< "";
    } cout<<endl;
} return 0;
    } void input (double s[][4],int n) {int i,j;
        for (i=0,s[i][3]=0; i<n; i++) {cout<< "first" <<i+1<< "Students ' scores:";
            for (j=0; j<3; J + +) {cin>>s[i][j];
        S[I][3]+=S[I][J];
    }}} void input (String name[],int n) {int i;
    for (i=0; i<n; i++) {cin>>name[i];
    }} void output (double s[][4],int n) {int i; for (i=0; i<n; i++) {cout<< "<<i<<" Students ' grades: Advanced Mathematics: "<<s[i][0]<<" << "English:" & lt;< s[i][1]<< "" << "C + +:" <<s[i][2]<< "<<" Total score: "<<s[i][3]<<" "<&
    Lt;endl;
    }} double Max (double s[][4],int n,int i) {int J;
    Double Max;
    max=0;
    for (j=0; j<n; J + +) {if (S[j][i]>max) max=s[j][i];
} return max;
  } double min (double s[][4],int n,int i) {int J;  Double min;
    min=10000;
    for (j=0; j<n; J + +) {if (s[j][i]<min) min=s[j][i];
} return min;
    } double avg (double s[][4],int n,int i) {int J;
    Double avg,sum=0;
    for (j=0; j<n; J + +) {Sum+=s[j][i];
    } avg=sum/n;
return avg;
 }

Operation Result:

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.