c 實現學生類設計

2021-10-07 01:33:28 字數 1441 閱讀 9107

功能:設計乙個student(學生)類

注意:  

1、建構函式分為帶引數和不帶引數兩種,注意宣告與定義

2、從鍵盤輸入基本資訊,呼叫帶引數的建構函式生成學生物件

3、當輸入的資料不合理時,要有相應的處理和提示

**:
#include

#include

using

namespace std;

//student類

class

student

;student::

student

(void

)//採用初始化列表來初始化字段

student::

student

(string id, string name,

char ***, string birthday,

int grade, string stu_class, string institute, string major):id

(id)

,name

(name)

,***

(***)

,birthday

(birthday)

,grade

(grade)

,stu_class

(stu_class)

,institute

(institute)

,major

(major)

//student::student(int garde, string institue, string major)

//student::

student

(const student& obj)

student::

~student()

void student::

setinfo

(string id, string name,

char ***, string birthday,

int grade, string stu_class, string institute, string major)

void student::

show()

int student::

check_input()

return-1

;}return1;

}//程式的主函式

intmain()

}}cout<

"以下是所有學生的基本資訊:\n"

<

for(

int i=

0;i)return0;

}

執行結果截圖:

c 實現學生成績管理

include include include include include struct score void main printf all the score bellow n printf id t語文 t英語 t數學 n for i 0 i int max 0 int m 0 for i...

C語言實現學生選課系統

include include include include typedef struct curr curr,pcurr typedef struct stu stu,pstu pcurr creat curr pcurr curr head 建立鍊錶,課程資訊 pcurr find curr ...

Python實現學生管理系統

from prettytable import prettytable class studentinfo def init self print print 學生管理系統 v1.0 print 1 新增學生 print 2 顯示所有學生 print 3 查詢學生 print 4 修改學生 prin...