>即時新聞-熱門

2008年8月14日星期四

vc++ - 類別 : 建構子

#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();

0 评论:

 
妹咕數位學園歡迎網友們來信指教 妹咕信箱