level 1
#include "stdafx.h"#
include "iostream"#include "string"using namespace std;class Student{private: string id; string name; float Chinese; float math; float English; float sum; float average;public: void SetId() { cout<<"Please Input the id:"; cin>>id; } void SetName() { cout<<"Please Input the name:"; cin>>name; } void SetScore() { cout<<"Please Input the Chinese score:"; cin>>Chinese; cout<<"Please Input the math score:"; cin>>math; cout<<"Please Input the English score:"; cin>>English; } void Calculate() { sum=Chinese+math+English; average=sum/3; } float GetSum() { return sum; } float GetAverage() { return average; }};int main(int argc, char* argv[]){ Student I; I.SetId(); I.SetName(); I.SetScore(); I.Calculate(); cout<
2008年01月05日 02点01分