13 weeks (Array stats score)

Source: Internet
Author: User

/*
*copyright (c) 2014, College of Computer Science, Yantai University
*all rights reserved.
* File name: Array statistics score

* Wangzhong
* Completion Date: 2014.11.23

* Version Number: v1.0
*
* Problem Description: Enter the number of students, and enter the student scores, the highest score, the lowest score, the average score, study number

* Input Description: Number of students, score

* Program output: Highest score, lowest score, average score, school number

#include <iostream>using namespace Std;int main () {int score[50];    int num,i,sum=0,max=-1,min=999, average; cout<< "How many students are there in the group?"    ";    cin>>num;    cout<< "Please enter student scores:" <<endl;        for (i=0; i<num; i++) {cout<< "Please enter the" <<i<< "Students results:";    cin>>score[i];        } for (i=0; i<num; i++) {sum+=score[i];        if (Max<score[i]) max= score[i];    if (min>score[i]) min = score[i]; } sum=score[i]+sum;average=sum/num;cout<< "Highest score:" <<max<< ";cout<<" Minimum score: "<<min        << ";cout<<" average score: "<<average<<endl;int x=0,s=0;for (i=0;i<num;i++) {if (Max==score[i])        x + +; if (Min==score[i]) s++;} cout<< "Highest scores have" <<x<< "people," << "Their study number is:"; for (i=0;i<num;i++) if (Max==score[i]) cout<<i    << "";    cout<< "min" <<s<< "People" << "Their study number is:"; for (i=0;i<num;i++) if (min==score[i]) cout<<i<< ""; return 0;} 


13 weeks (Array stats score)

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.