#include<iostream>
#include<string>
using namespace std;
class basedata {
private:
char no[6];
char name[20];
int math;
int china;
int english;
public:
void showbasedata();
basedata();
};
basedata::basedata()
{
strcpy(no,"1234");
strcpy(name,"楊妹咕");
math=90;
china=90;
english=89;
};
void basedata::showbasedata(void)
{
cout << "***************************" << endl;
cout << "學號:" << no << endl;
cout << "姓名:" << name << endl;
cout << "數學:" << math << endl;
cout << "國文:" << china << endl;
cout << "英文:" << english << endl;
cout << "***************************" << endl;
}
void main()
{
basedata a;
a.showbasedata();
}
>即時新聞-熱門
2008年8月14日星期四
vc++ - 類別 : 建構子
发帖者 ALEX 时间: 09:40
标签: VISUAL C++
订阅:
博文评论 (Atom)
0 评论:
发表评论