最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

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

c++關(guān)于類的使用 求大神幫我看一下哪里錯(cuò)了

c++關(guān)于類的使用 求大神幫我看一下哪里錯(cuò)了

C++
qq_輩孓祗ai禰_04023960 2016-11-28 15:32:31
#include <iostream>#include <iomanip>using namespace std;class Student{private:? ? string strname;? ? int nindex;? ? double ?score;public:? ? string getstrname()? ? {return strname;}? ? int getnindex()? ? {return nindex;}? ? double getscore()? ? {return score;}? ? void setstrname(string strnewname)? ? {strname=strnewname;}? ? void setnindex(int nnewindex)? ? {nindex=nnewindex;}? ? void setscore(double newscore)? ? {score=newscore;}};int main(){Student stu1,stu2;stu1.setstrname("張三");stu1.setnindex(100);stu1.setscore(90);stu2.setstrname("李四");stu2.setnindex(101);stu2.setscore(70);cout<<"學(xué)生成績(jī)"<<endl;cout<<left;cout<<setw(10)<<"學(xué)號(hào)"<<setw(10)<<"姓名"<<setw(10)<<"成績(jī)"<<endl;cout<<setw(10)<<stu1.getnindex(100)<<setw(10)<<stu1.getstrname("張三")<<setw(10)<<stu1.getscore(90)<<endl;cout<<setw(10)<<stu2.getnindex(101)<<setw(10)<<stu2.getstrname("李四")<<setw(10)<<stu2.getscore(70)<<endl;? ? return 0;}
查看完整描述

1 回答

?
onemoo

TA貢獻(xiàn)883條經(jīng)驗(yàn) 獲得超454個(gè)贊

類中的這幾個(gè) getXXX() 成員函數(shù)都是不需要參數(shù)的,你在調(diào)用它們時(shí)為什么要傳參呢? ? 所以就錯(cuò)了啊...

查看完整回答
反對(duì) 回復(fù) 2016-11-28
  • 1 回答
  • 0 關(guān)注
  • 1049 瀏覽

添加回答

舉報(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)