17th Week Item 6-Student Achievement Statistics (i)

Source: Internet
Author: User

Each student's informatics number, name, C + +, high number, English scores. An array of structural bodies that define a student's performance, including the number of data members (char num[13]), the name (name), the score of the course (grade), the total score (score), and the averaging (average)).
(1) Enter the information of n students from the keyboard (n is defined as a constant variable);
(2) To find out the total and average of each student, and stored in the structure of the array (can be read into the process of "by the Way" calculation);

(3) Output each student's informatics number, name, total score and sharing.

/** Copyright (c) 2014, Yantai University School of Computer * All right reserved.* Shao * file: temp.cpp* finish: December 20, 2014 * version number: v1.0*/#include <iostream > #include <iomanip>using namespace std;struct student{    char num[13];    Char name[10];    int cpp;    int math;    int 中文版;    int grade;    Double average;}; const int N=3;int Main () {    int i, j, K;    Define struct-body array    Student stu[n];    cout<< "Please enter student's number, name, CPP score, math score and English score in turn" <<endl;    for (i=0; i<n; i++)    {          Cin>>stu[i].num>>stu[i].name>>stu[i].cpp>>stu[i].math >>stu[i].english;          Stu[i].grade=stu[i].cpp+stu[i].math+stu[i].english;          stu[i].average=stu[i].grade/3.0;    }    cout<< "Student's school number, name, total score, average score;" <<endl;    for (i=0;i<n;i++)        cout<<stu[i].num<< "" <<stu[i].name<< "" <<stu[i].grade< < "" <<stu[i].average<<endl;        return 0;}

Operation Result:



@ Mayuko

17th Week Item 6-Student Achievement Statistics (i)

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.