WEEK 1: a structured array of Project 3 student scores (including student ID, name, score, total score, and average score)

Source: Internet
Author: User
/** Copyright and version declaration section of the Program * Copyright (c) 2013, student * All rightsreserved from computer College of Yantai University. * file name: riqi. cpp * Author: Li Yang * Completion Date: July 15, March 5, 2013 * version: v1.0 * input Description: * Problem description: defines a structure array of student scores. Output the student ID, name, total score, and average score of each student. */# Include <iostream> # include <iomanip> using namespace std; struct Student {long num; char name [10]; double sum; double average; double score1; double score2; double score3 ;}; int main () {Student array [3]; cout <"Enter the student ID, name, C ++ score, English score, and high score of the three students in sequence. "<Endl; for (int I = 0; I <3; ++ I) {cin> array [I]. num> array [I]. name> array [I]. score1> array [I]. score2> array [I]. score3; array [I]. sum = array [I]. score1 + array [I]. score2 + array [I]. score3; array [I]. average = array [I]. sum/3;} cout <"student ID" <setw (12) <"name" <setw (10) <"C ++ score" <setw (10) <"English score" <setw (10) <"high score" <setw (8) <"total score" <setw (8) <"average score" <endl; for (int I = 0; I <3; ++ I) {cout <array [I]. num <setw (12) <array [I]. name <setw (8) <array [I]. score1 <setw (8) <array [I]. score2 <setw (8) <array [I]. score3 <setw (12) <array [I]. sum <setw (6) <array [I]. average <endl;} return 0 ;}

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.