第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

關(guān)于c++的簡(jiǎn)單類的問(wèn)題

關(guān)于c++的簡(jiǎn)單類的問(wèn)題

C++
為啥有昵稱 2017-03-29 19:05:05
/*定義一個(gè)描述學(xué)生通訊錄的類,數(shù)據(jù)成員包括:姓名、學(xué)校、電話號(hào)碼和郵編;成員函數(shù)包括:輸出各個(gè)數(shù)據(jù)成員的值,分別設(shè)置和獲取各個(gè)數(shù)據(jù)成員的值*/#include<iostream>#include<string>using namespace std;class Student{private:?char *Name;?char *School;?char Tel[15];?char PC[6];public:?void Assign(char *name, char *shcool, char tel[], char pc[]);?void SetName(char *name);?void SetSchool(char *school);?void SetPhone(char *tei);?void SetPC(char *pc);?char GetName();?char GetSchool();?char GetPhone();?char GetPC();// 設(shè)置數(shù)據(jù)和獲得數(shù)據(jù)?void ShowStudent();//輸出數(shù)據(jù)};void Student::Assign(char *name, char *school, char tel[], char pc[]){?SetName(name);?SetSchool(school);?SetPhone(tel);?SetPC(pc);}void Student::SetName(char *name){?Name = new char[strlen(name) + 1];?strcpy(Name, name);}void Student::SetSchool(char *school){?School = new char[strlen(school) + 1];?strcpy(School, school);}void Student::SetPhone(char *tel){?strcpy(Tel, tel);}void Student::SetPC(char *pc){?strcpy(PC, pc);}char Student::GetName(){?return *Name;}char Student::GetSchool(){?return *School;}char Student::GetPhone(){?return *Tel;}char Student::GetPC(){?return *PC;}void Student::ShowStudent(){?cout << Name << '\t' << School << '\t' << Tel << '\t' << PC << endl;}//學(xué)生通訊類int main(){?int n;?char *name="qiaoxu";?char *school="jiangsudaxue";?char tel[15];?char pc[6];?cout << "請(qǐng)輸入學(xué)生人數(shù)n:" << endl;?cin >> n;?Student *s;?s = new Student[n];?cout << "name" << '\t' << "school" << '\t' << "telphone" << '\t' << "post code:" << endl;?for (int i=0;i<n;i++)?{??cin >> name>> school>> tel >> pc;??s[i].Assign(name, school, tel, pc);?}?for (int j = 0; j < n; j++)?{??s[j].ShowStudent();?}?delete[]s;?system("pause");?return 0;}問(wèn)題是?? 會(huì)提示寫入權(quán)限沖突_Str 是 0x132DC74
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 1498 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)