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

正文內(nèi)容

上海大學(xué)acm集訓(xùn)隊(duì)培訓(xùn)資料-文庫(kù)吧

2025-06-01 22:27 本頁(yè)面


【正文】 // void functions don39。t need return statements下面試運(yùn)行情況:Simon says touch your toes 3 times.Pick an integer: 512Simon says touch your toes 512 times.Done! 程序中包含了cin語(yǔ)句來(lái)從鍵盤(pán)上獲取數(shù)據(jù)。 該程序中包含了除main函數(shù)以外的另一個(gè)函數(shù)simon(),他和main函數(shù)定義的格式相同,函數(shù)的統(tǒng)一格式如下:type functionname (argumentlist){ statements} 注意,定義simon()的代碼在main()函數(shù)的后面,C++中不允許將函數(shù)定義在另一個(gè)函數(shù)內(nèi)。每個(gè)函數(shù)的定義都是獨(dú)立的,所有的函數(shù)的創(chuàng)建都是平等的。simon()函數(shù)的函數(shù)頭定義如下:void simon(int n)以void 開(kāi)頭表明simon()沒(méi)有返回值,因此我們不能類是這樣的使用它。simple = simon(3)。 有返回值的函數(shù)如下// converts stone to poundsinclude iostreamint stonetolb(int)。 // function prototypeint main(){ using namespace std。 int stone。 cout Enter the weight in stone: 。 cin stone。 int pounds = stonetolb(stone)。 cout stone stone = 。 cout pounds pounds. endl。 return 0。}int stonetolb(int sts){ return 14 * sts。}下面是運(yùn)行情況:Enter the weight in sone: 1414 stone = 196 pounds.程序通過(guò)cin語(yǔ)句給stone提供一個(gè)值,然后在main函數(shù)中,把這個(gè)值傳遞給stonetolb()函數(shù),這個(gè)植被賦給sts之后,stonetolb()用return 將 14*sts返回給main()。函數(shù)頭中的int表明stonetolb()將返回一個(gè)整數(shù)。除了int類型之外,C++的內(nèi)置數(shù)據(jù)類型還有:unsigned long、long、unsigned int、unsigned short、short、char、unsigned char、signed char、bool、  float、double、long double。對(duì)于數(shù)據(jù)的輸入和輸出有幾道練習(xí)題至二、算法基礎(chǔ)1. 什么是算法 算法是完成特定任務(wù)的有限指令集。所有的算法必須滿足下面的標(biāo)準(zhǔn):a. 輸入。由外部題共零個(gè)或多個(gè)輸入量。b. 輸出。至少產(chǎn)生一個(gè)輸出量。c. 明確性。每條指令必須清楚,不具模糊性。d. 有限性。如果跟蹤算法的指令,那么對(duì)于所有的情況,算法經(jīng)過(guò)有限步以后終止。e. 有效性。每條指令必須非?;A(chǔ),原則上使用筆和紙就可以實(shí)現(xiàn)例 選擇排序void SelectionSort(Type a[], int n)//Sort the arrat a[1:n] into nondecreasing order.{ for (int i=1。 i=n。 i++) { int j=1。 for (int k=i+1。 k=n。 k++) if (a[k] a[j]) j = k。 Type t = a[i
點(diǎn)擊復(fù)制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1