C 物件導向程式設計 實驗報告1

2021-10-04 17:04:27 字數 1585 閱讀 5333

我的部落格

#include

#include

#include

#include

using

namespace std;

class

bookcard

;bookcard::

bookcard

(string id, string stuname,

int num)

bookcard::

bookcard()

void bookcard::

display()

bool bookcard::

borrow()

else

}void

f(bookcard &bk)

else

bk.display()

;}intmain()

這題主函式部分比較開放,可以任意發揮。

(資料也是我瞎編的,可以隨便改~)

#include

#include

#include

#include

using

namespace std;

class

time

;time::

time

(const time &t)

time::

time

(int h =0,

int m =0,

int s =0)

time::

~time()

void time::

increaceonesecond()

else

if(hour <23)

else

}void time::

printtime()

void time::

settingtime

(int h,

int m,

int s)

void

f(time *t)

intmain()

同上,主函式可任意發揮啦

#include

#include

#include

#include

using

namespace std;

class

girl

;class

boy;

boy::

boy(string n =

"none"

,int a =0)

boy::

~boy()

class

girl

;girl::

girl

(string n =

"none"

,int a =0)

girl::

~girl()

void

visitboygirl

(boy &b, girl &g)

intmain()

最後求個贊~

C 物件導向程式設計 實驗報告 實驗四

1 掌握模板的定義和使用方法 2 根據要求正確定義模板類,例項化模板 3 掌握檔案流的開啟 關閉及讀寫方法。暫未實現 1 單鏈表模板的定義和實現。2 員工錶類資料的讀寫。1 單鏈表模板的定義和實現,並設計主程式對模板進行測試。2 使用檔案流為實驗一的員工錶類提供資料讀寫的方法 listnode.h ...

C程式設計實驗報告

c程式設計實驗報告 1 了解字元在計算機中以ascii碼方式表示,了解字元的型別 字長其數的表示範圍。2 掌握c語言資料型別,熟練掌握變數定義 3 使用scanf 輸入變數的值,使用printf 輸出變數 4 掌握運算子與表示式的使用方法及其優先順序和結合性規律。5 鞏固對演算法概念的理解,掌握運算...

C程式設計實驗報告

試驗專案 1.字元與ascll碼 2.運算子與表示式的運用 3.順序結構應用程式 4.數學函式的演算法描述 5.雞兔同籠的演算法描述 6.確定座標的演算法描述 一,實驗目的與要求 1.實驗目的 具體要求 1 從鍵盤輸入任意字元,且在輸入前要求有提示資訊。2 輸出兩行 第一行是字元形式輸出3個字元,3...