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 <cstring>//the following two header files do not write the compiler will not error, operation is normal. 3#include <cstdio>//but when they get to the OJ, they get less: "Complete error."4 using namespacestd;5 classStudent {6 Private:7 Charname[ -], stdnum[ -];8 intAge , A, B, C, D, score;9 Public:Ten voidinput () { OneCin.getline (Name, -,','); Ascanf"%d,", &Age ); -Cin.getline (Stdnum, -,','); -scanf"%d,%d,%d,%d", &a, &b, &c, &d);//use SACNF to enter commas the } - voidoutput () { -cout << name <<","<< Age <<","<< Stdnum <<","<<score; - } + voidaverage () { -Score = (A + B + C + D)/4; + } A }; at - intMain () - { - student Student1; - student1.input (); - student1.average (); in student1.output (); - return 0; to}
Simple implementation of Student information processing program