A tentative study of programming job-c++ simple implementation of Student information processing program

Source: Internet
Author: User

Simple implementation of Student information processing program

Source: POJ (Coursera statement: The exercises completed on POJ will not count against the final results of Coursera. )

Note: Total time limit: 1000ms memory limit: 65536kB

Describe

In a Student information processing program, it is required to implement a class that represents a student, and all member variables should be private.

(Note: The evaluation system cannot automatically determine whether a variable is private.) We will be at the end of the unification of the operation of the inspection, please students in strict accordance with the requirements of the completion, otherwise it may affect the performance of the work. )

Input

Name, age, school number, average grade for the first school year, average performance for the second school year, average grade for the third school, average results for the fourth school year.

The name, the school number is a string, does not contain spaces and commas, the age is a positive integer, the result is a nonnegative integer.

Each part of the content is separated by a single English comma ",", no extra space

Output

One row, output sequentially: Name, age, school number, four-year average score (rounded down).

Each part of the content is separated by a single English comma ",", no extra space.

Sample input
Tom,18,7817,80,80,90,70
Sample output
tom,18,7817,80
1#include <iostream>2#include <string>3#include <cstdio>4 using namespacestd;5 classStudent {6 Private:7     intAge , Score1, Score2, Score3, Score4;8     Charname[ -], num[ -];9     intaverage;Ten  Public: OneStudent (CharAname[],intAageCharAnum[],intAscore1,intAscore2,intAscore3,intAscore4) { A strcpy (name, aname); -Age =Aage; - strcpy (num, anum); theScore1 =Ascore1; -Score2 =Ascore2; -Score3 =Ascore3; -Score4 =Ascore4; +     } -  +     intGetaverage () { A         return(Score1 + score2 + score3 + score4)/4; at     } -  -     Char*GetName () { -         returnname; -     } -  in     intGetage () { -         returnAge ; to     } +  -     Char*Getnum () { the         returnnum; *     } $ Panax Notoginseng }; - intMain () { the     Charname[ -], A, num[ -]; +     intAge , Score1, Score2, Score3, Score4; ACin.getline (Name, -,','); theCIN >>Age ; +A =GetChar (); -Cin.getline (NUM, -,','); $CIN >> Score1 >> a >> score2 >> a >> score3 >> a >>Score4; $ Student S (name, age, Num, Score1, Score2, Score3, Score4); -cout << s.getname () <<","<< s.getage () <<","<< S.getnum () <<","<<s.getaverage (); -     return 0; the}

A tentative study of programming job-c++ simple implementation of Student information processing program

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.