//?ProjectOne.cpp?:?定義控制臺(tái)應(yīng)用程序的入口點(diǎn)。
//
#include?"stdafx.h"
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using?namespace?std;
class?TV
{
public:
??char?a[10];
??int?high;
private:
?char?b[10];
?int?wide;
};
class?Coordinate
{
public://用戶可以看到
?int?x;
?int?y;
?void?printX()
?{
??cout?<<?x?<<?endl;
?}
?void?printY()
?{
??cout?<<?y?<<?endl;
?}
};
class?Student
{
public:
?void?setName(string?_name)
?{
??m_strName?=?_name;
?}
?string?getName()
?{
??return?m_strName;
?}
?void?setGender(string?_gender)
?{
??m_strGender?=?_gender;
?}
?string?getGender()
?{
??return?m_strGender;
?}
?int?getScore()
?{
??return?m_iScore;
?}
?void?initScore()
?{
??m_iScore?=?0;
?}
?void?study(int?_score)
?{
??m_iScore?+=?_score;
?}
private:
?string?m_strName;
?string?m_strGender;
?int?m_iScore;
};
int?main()
{
?Student?stu;
?stu.initScore();
?string?a?=?"張三",?b?=?"女";
?stu.setName(a);
?stu.setGender(b);
?stu.study(5);
?stu.study(5);
?cout<<?stu.getName()?<<?'?'?<<?stu.getGender()
??<<?stu.getScore();
????return?0;
}
2017-05-20
<< <<????之間不能直接接‘’