freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

面向?qū)ο蟪绦蛟O(shè)計c實(shí)驗(yàn)報告_-wenkub

2022-09-07 17:26:34 本頁面
 

【正文】 ”。 coutSecond秒 endl。 Minute=0。 int Minute。 (不帶參數(shù))使小時、分、秒均為 0。 int main() { time s(10,40,50)。 } private: int Hour。 Second=k。 //輸出顯示出來 } SetTime 成員函數(shù),并在主函數(shù)中使用構(gòu)造函數(shù)設(shè)置時間為 10點(diǎn) 40 分 50 秒,并顯示該時間。 }。 coutSecond秒 endl。 Minute=j。 實(shí)驗(yàn)內(nèi)容 ,時間類中有 3個私有數(shù)據(jù)成員( Hour, Minute, Second)和兩個公有成員函數(shù)( SetTime 和 PrintTime)。 。i10。j++) //內(nèi)部循環(huán) { if(a[j]a[j+1]) //如果不是從小到大排列則交換位置關(guān)系 { t=a[j]。 //輸入數(shù)據(jù) } for(i=0。 //定義三個整型變量 i,j,t cout從鍵盤輸入十個整數(shù) :endl。i++) //輸出前 20 個斐波那契數(shù)列 { couta[i]endl。i20。要求用數(shù)組存儲數(shù)列 )。i++) //當(dāng)有能被整除的數(shù)則返回 0,后則返回 1 if(n%i==0) return 0。 //根據(jù) fun( i)的真值,為 1 時表示為素數(shù)則輸出 } int fun(int n) //函數(shù)的定義 { int i,t。 //定義變量 i int fun(int)。 default : cout五分制為 :1endl。 //同上 case 7: cout五分制為 :3endl。 //對 a 求商并賦值給 b switch(b) //確定 b的值為什么值 { case 10 : case 9: cout五分制為 :5endl。 //5 } 使用 if 嵌套語句實(shí)現(xiàn)某一范圍內(nèi)的輸出 具體看注釋 include void main() { int a,b。 //如果 0a60,輸出是五分制為: 1 else if(a70) cout五分制為 :2endl。 //輸入一個百分制的數(shù) cina。百分制與五分制之間的關(guān)系見下表。 循環(huán)的用法。 答:內(nèi)存申請: new 釋放: delete 使用 malloc 函數(shù)時必須使用 sizeof 函數(shù)來計算所需要的字節(jié)數(shù),而 new 可以根據(jù)數(shù)據(jù)類型自動計算所要分配內(nèi)存的大小,這 就減小了發(fā)生錯誤的可能性。 cin*r。 答:第一個 sum為全局變量,第二個 ::sum為局部變量。 ( 2)在局部變量和全局變量作用域重疊區(qū)域,默認(rèn)哪個變量起作用;如果一定要訪問全局變量,怎么實(shí)現(xiàn)。 } cout sum of all is : ::sum。 for(i=0。 include int a[]={1,2,3,4,5,6,7,8,9,10}。 ( 2) C 允許兩個函數(shù)同名(函數(shù)重載)么,函數(shù)重載的作用是什么? 答:不允許,作用:方便使用函數(shù),只要函數(shù)參數(shù)的類型不同,或者參數(shù)的個數(shù)不同,或者二者兼而有之,兩個或者兩個以上的函數(shù)可以使用相同的函數(shù)名。 coutf(x)endl。 include inline int f(int x) { return 2*x*x+4*x+5。 C++除了可以照常使用這兩個函數(shù)進(jìn)行輸入輸出外,還增加了標(biāo)準(zhǔn)輸入流對象 cin和標(biāo)準(zhǔn)輸出流對象 cout 來進(jìn)行輸入和輸出。 cinname。 用的概念,掌握引用的使用方法。 C++數(shù)據(jù)類型常量和變量以及修飾符的使用方法。 《 面向?qū)ο蟪绦蛟O(shè)計 》 實(shí)驗(yàn) 報告 學(xué) 院: 專 業(yè): 班級學(xué)號: 姓 名: 學(xué) 期: 教 師: 實(shí)驗(yàn)一 C++基礎(chǔ)練習(xí) 院(系): 課程名稱: 面向?qū)ο蟪绦蛟O(shè)計 教師簽名: 班級 學(xué)號 實(shí)驗(yàn)室 姓名 實(shí)驗(yàn)成績 所用軟件 Word 文檔 、 VC++軟件 實(shí)驗(yàn)?zāi)康暮鸵? C++程序的基本格式與規(guī)范,學(xué)會編寫簡單的 C++程序。 、函數(shù)調(diào)用和函數(shù)說明的方法。 實(shí)驗(yàn)內(nèi)容和步驟 1. 調(diào)試如下的代碼并回答問題。 coutwele nameendl。 Iostream是 C++系統(tǒng)定義的一個頭文件,在這個文件中聲明了程序所需要的輸入和輸出操作的有關(guān)信息。 } inline double f(double x) { return 2*x*x+4*x+5。 coutf(y)endl。實(shí)現(xiàn)函數(shù)編譯的多態(tài)性。 int sum。i10。 cout sum of odd is: sum。 答:默認(rèn)局部變量起作用。 。 coutArea is:*(*r)*(*r)。 new能夠自動返回正確的指針類型,而不必像 malloc 函數(shù)那樣,必須在程序中進(jìn)行強(qiáng)制類型轉(zhuǎn)換,才能使其返回正確的指針類型。 。分別使用 if分支結(jié)構(gòu)和 switch結(jié)構(gòu)編寫程序。 if(a0amp。 //同上以此類推 2 else if(a80) cout五分制為 :3endl。 cout從鍵盤輸入百分制 :endl。break。break。break。 //函數(shù)的聲明 for(i=3。 //定義兩個整型變量 t=sqrt(n)。 return 1。 include void main() { int a[20]={1,1}。i++) { a[i]=a[i1]+a[i2]。 } } 4. 編程實(shí)現(xiàn)輸入 10 個整數(shù),從小到大排列輸出。 //提示性語句從鍵盤輸入十個整數(shù) for(i=0。i10。 a[j]=a[j+1]。i++) //輸出整理好后的數(shù)組 { couta[i]endl。 。 SetTime 根據(jù)傳遞的 3 個參數(shù)為對象設(shè)置時間; PrintTime負(fù)責(zé)將對象表示的時間顯示輸出。 Second=k。 } private: //三個私有成員 int Hour。 int main() { time s。說明構(gòu)造函數(shù)和 SetTime 成員函數(shù)在使用時的區(qū)別。 } void PrintTime() { coutHour點(diǎn) 。 int Minute。 //定義類的對象時調(diào)用構(gòu)造函數(shù) time //分別給數(shù)據(jù)成員 Hour、 Minute 和 Second賦初值 40和 50 ()。 include class time{ public: time()。 int Second。 Second=0。 } int main() { time s1。說明析構(gòu)函數(shù)的特點(diǎn)和調(diào)用時機(jī)。 private: int Hour。 time::time(int i,int j,int k) //構(gòu)造函數(shù)的定義 { Hour=i。 //顯示構(gòu)造函數(shù)被調(diào)用的信息 } time::~time() //定義析構(gòu)函數(shù) { coutgoodbyeendl。 } int main() { time s(10,40,50)。說明拷貝構(gòu)造函數(shù)的作用特點(diǎn)。 } time(const time amp。 } void PrintTime() { coutHour點(diǎn) 。 int Minute。 //定義對象 s1,調(diào)用了普通的構(gòu)造函數(shù) time s2(s1)。在建立一個新對象時,使用一個已經(jīng)存在的對象去初始化這個新對象。 。 includeiostream using namespace std。 } void input() { int i。 } void display() { int j。 } protected: int *alist。 cinleng。 return(0)。 class student {private: int sno。 public: void input() { cinsnonameagescore。 cout分?jǐn)?shù) scoreendl。 int i。k[i]。普通數(shù)組是存放類型一樣的數(shù)據(jù),指針可以通過訪問首地址一一訪問存放的數(shù)值。 string name。 } void print() { coutthis=this學(xué)號 snoendl。 } }。i=9。注意構(gòu)造函數(shù)、析構(gòu)函數(shù)的編寫以及靜態(tài)成員的初始化,并說明這兩個成員設(shè)置為靜態(tài)成員的原因。 int age。 static float sum。 cout年齡 ageendl。 } student(int snol,char *namel,int agel,int scorel) { sno=snol。 score=scorel。 } ~student() { delete name。 int student::count=0。 ()。 ()。 return 0。 output,實(shí)現(xiàn)和成員函數(shù) print 相同的功能。 string name。 } friend void output(student amp。 cout年齡 ageendl。p) { cout學(xué)號 姓名 endl。 for(i=0。 } } 友員函數(shù)可以通過入口參數(shù)傳遞進(jìn)來的對象名(或?qū)ο笾羔?、對象引用)來訪問該對象所有的的數(shù)據(jù)成員,提高了程序運(yùn)行效率。 。 ~MyArray()。 //指向動態(tài)申請的一組空間 int length。 ~MyArray()。 //指向動態(tài)申請的一組空間 int length。 } MyArray::~MyArray() { delete []alist。 for(i=0。 cout輸出的數(shù)組元素為: endl。 } } int main() { MyArray s(4)。 includeiostream using namespace std。 } void input() { int i。 } void display() { int j。 } protected: int *alist。 int j。i++) {for(j=i+1。
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1