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

正文內(nèi)容

[計算機軟件及應(yīng)用]c上機實習(xí)題(已修改)

2025-01-30 04:09 本頁面
 

【正文】 實驗題目(共4題, 第1題)標題: 字符串輸入輸出 時 限: 1000 ms 內(nèi)存限制: 10000 K 總時限: 3000 ms 描述: 編寫一個簡單的控制臺應(yīng)用程序,先輸入姓名,如“John”,再輸出問候語,如“Hello, John!”。 輸入: John 輸出: Hello, John! 輸入樣例: John 輸出樣例: Hello,John! 提示: 使用string類定義字符串對象,需包含頭文件string;使用cin和提取符從鍵盤輸入數(shù)據(jù),使用cout和插入符輸出結(jié)果到屏幕,需包含頭文件iostream;注意使用名稱空間std。 來源:include iostreaminclude include using namespace std。int main(){ char s[10]。 gets(s)。//cins。 cout Hello, s ! endl。 return 0。} 示例代碼include iostreaminclude stringusing namespace std。int main(){ string szName。 cin szName。 cout Hello, szName ! endl。 return 0。} 實驗題目(共4題, 第2題)標題: 求3個數(shù)的平均值 時 限: 1000 ms 內(nèi)存限制: 10000 K 總時限: 3000 ms 描述: 從鍵盤上輸入3個浮點數(shù),求這3個數(shù)的平均值。 輸入: 3個浮點數(shù) 輸出: 3個數(shù)的平均值 輸入樣例: 輸出樣例: 提示: 用using namespace std。明確名字空間用cin對象,采用運算符輸入數(shù)據(jù)用cout對象,采用運算符輸出數(shù)據(jù) 來源:include iostreamusing namespace std。int main(){ float a,b,c,aver=0。 cin a。 cin b。 cin c。 aver=(a+b+c)/。 cout aver endl。 return 0。} 示例代碼include iostreamusing namespace std。int main(){ float x1, x2, x3。 cinx1x2x3。 cout(x1+x2+x3)/3endl。 return 0。}實驗題目(共4題, 第3題)標題: 求鞍點 時 限: 1000 ms 內(nèi)存限制: 10000 K 總時限: 3000 ms 描述: 輸入一個二維矩陣,找出其中所有鞍點。如果矩陣有鞍點,則輸出鞍點的信息:行號、列號、值;如果沒有鞍點,則輸出“Not found!”。所謂“鞍點”,是指滿足以下條件的矩陣中的一個數(shù):在它所在的行上最小、所在列上最大。 該題中假設(shè)矩陣中任意兩個數(shù)互不相等。 輸入: 輸入數(shù)據(jù)有多行:第一行是矩陣的行數(shù)m和列數(shù)n 從第二行起共包含m行,每行包含n個數(shù),為矩陣的一行數(shù)據(jù) 輸出: 如果矩陣有鞍點,輸出鞍點的信息,包括:所在行、所在列、值 如果沒有鞍點,輸出Not found! 輸入樣例: 3 411 23 56 4712 45 66 9016 77 34 18 輸出樣例: 2016 提示: 要求用動態(tài)內(nèi)存分配來完成,可用new和delete實現(xiàn);屏幕輸出只有2 0 16(加回車換行),不能有其它信息。 來源:include iostreamusing namespace std。void an(int h,int l){ int ma,mi,a=0,b=0。 int **p。 p=new int* [h]。 for(int i=0。 ih。 i++) { p[i]=new int[l]。 } for(int i=0。 ih。 i++) { for(int j=0。 jl。 j++) { cinp[i][j]。 } } int flag=0。 for(int i=0。 ihamp。amp。flag==0。 i++) { mi=p[i][0]。 a=i,b=0。 for(int j=0。 jl。 j++) { if(p[i][j]mi) { mi=p[i][j]。 a=i,b=j。 } } for(int t=i+1。 th。 t++) { ma=mi。 if(map[t][b])ma=p[t][b]。 } if(ma==mi) { flag=1,couta b maendl。 } } if(flag==0) coutNot found!endl。 delete []p。}int main(){ int h,l。 cinhl。 an(h,l)。 return 0。}示例代碼include iostreamusing namespace std。int main(){ int **mat。 int *matRow, *matCol。 int nMaxRow=0, nMaxCol=0。 bool bFind=false。 int nTargetRow=0, nTargetCol=0, nSaddlePoint=0。 int i, j。 //cout Please input the number of rows and the number of columns: endl。 cin nMaxRow nMaxCol。 //Allocate memories for the two dimensional matrices mat = new int *[nMaxRow]。 for (i=0。 inMaxRow。 i++) mat[i] = new int[nMaxCol]。 matRow = new int[nMaxRow]。 //Buffers to save the minimum element in each row matCol = new int[nMaxCol]。 //Buffers to save the maximum element in each column //Input the elements //cout Please input the elements: endl。 for (i=0。 inMaxRow。 i++) for (j=0。 jnMaxCol。 j++) cin mat[i][j]。 //Find the minimum element in each row for (i=0。 inMaxRow。 i++) { int nMin=mat[i][0]。 for (j=1。 jnMaxCol。 j++) { if(mat[i][j]nMin) nMin = mat[i][j]。 } matRow[i] = nMin。 } //Find the maximum element in each column for (j=0。 jnMaxCol。 j++) { int nMax=mat[0][j]。 for (i=1。 inMaxRow。 i++) { if(mat[i][j]nMax) nMax = mat[i][j]。 } matCol[j] = nMax。 } //Find the saddle point for (i=0。 inMaxRow amp。amp。 !bFind。 i++) { for (j=0。 jnMaxCol。 j++) { if(mat[i][j]==matRow[i] amp。amp。 mat[i][j]==matCol[j]) { nTargetRow = i。 nTargetCol = j。 nSaddlePoint = mat[i][j]。 bFind = true。 break。 } } } //Output the searched row and column and the corresponding saddle point if(!bFind) cout Not found! endl。 else cout nTargetRow nTargetCol nSaddlePoint endl。 //Release memories delete []matCol。 delete []matRow。 for (i=0。 inMaxRow。 i++) delete [] mat[i]。 delete [] mat。 return 0。} 實驗題目(共4題, 第4題)標題: 鏈表操作 時 限: 1000 ms 內(nèi)存限制: 10000 K 總時限: 3000 ms 描述: 建立一個鏈表,每個節(jié)點包括學(xué)生的學(xué)號、姓名、性別、年齡。先輸入5個學(xué)生的數(shù)據(jù),再輸入一個年齡,如果鏈表中有年齡等于此年齡的記錄,則刪除所有年齡等于此年齡的記錄,否則在鏈表的最后增加一個新節(jié)點,學(xué)號為180姓名為aaa,性別為male。 輸入: 創(chuàng)建鏈表時輸入5個職工的職工號和工資,學(xué)號為大于100且小于200的整數(shù),姓名為長度小于20的字符串,性別為長度小于10的字符串,年齡為大于等于0且小于200的整數(shù)。 輸出: 按順序輸出鏈表中的所有數(shù)據(jù),每個數(shù)據(jù)占一行。 輸入樣例: 101 zhangsan male 30103 lisi female 18105 wangwu male 25107 maliu male 28109 niuqi female 2228 輸出樣例: 101zhangsanmale30103lisifemale18105wangwumale25109niuqifemale22 提示: 要求用動態(tài)內(nèi)存分配實現(xiàn),注意new和delete的使用。 來源:include iostreamusing namespace std。class node{private: int _num,_age。 string _name,_sexy。public: node(int num,int age,string name,string sexy) { _num=num。 _age=age。 _name=name。 _sexy=sexy。 } void display(void) { cout_numendl。 cout_nameendl。
點擊復(fù)制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫吧 www.dybbs8.com
公安備案圖鄂ICP備17016276號-1