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

正文內容

[計算機軟件及應用]c上機實習題(編輯修改稿)

2025-02-14 04:09 本頁面
 

【文章內容簡介】 ut 4: HourWorker. endl。 cout Others: Quit endl。 cin sel。 switch(sel) { case 1: cin salaryabsenceDays。 cout getEarning(salary,absenceDays)。 break。 case 2: cin baseSalarysalesSumrate。 cout getEarning(baseSalary,salesSum,rate)。 break。 case 3: cin workPieceswagePerPiece。 cout getEarning(workPieces,wagePerPiece)。 break。 case 4: cin hourswagePerHour。 cout getEarning(hours,wagePerHour)。 break。 default: break。 } return 0。}示例代碼includeiostreamusing namespace std。double getEarning(double salary ,int absenceDays){ return (salary salary*absenceDays/22)。}// admindouble getEarning(double baseSalary ,double salesSum,double rate){ return (baseSalary + salesSum*rate)。}double getEarning(int workPieces,double wagePerPiece){ return (workPieces*wagePerPiece)。}double getEarning(double hours ,double wagePerHour){ return (hours*wagePerHour)。}int main(){ int kind = 0 。 cout Please select... endl。 cout 1: Manager. endl。 cout 2: Sales Man. endl。 cout 3: Pieces Worker. endl。 cout 4: HourWorker. endl。 cout Others: Quit endl。 cin kind 。 switch(kind) { case 1: { double salary 。 int abDays。 cinsalaryabDays。 coutgetEarning(salary,abDays)。 break。 } case 2: { double base 。 double salesSum。 double rate。 cinbasesalesSumrate。 coutgetEarning(base,salesSum,rate)。 break。 } case 3: { int workPieces。 double wagePerPiece。 cinworkPieceswagePerPiece。 coutgetEarning(workPieces,wagePerPiece)。 break。 } case 4: { double hours。 double wagePerHour。 cinhourswagePerHour。 coutgetEarning(hours,wagePerHour)。 break。 } default: break。 }// coutgetEarning(,11)。// coutgetEarning(,)。// coutgetEarning(100,)。// coutgetEarning(200,)。 return 0 。}來源: 實驗題目(共4題, 第2題)標題: 2. 引用傳遞 時 限: 1000 ms 內存限制: 10000 K 總時限: 3000 ms 描述: 設計一個函數(shù),將兩個浮點數(shù)傳入,然后通過引用把其和、差、積傳出。函數(shù)原型如下:void Math(float a,float b,float amp。sum,float amp。sub,float amp。pro)。 輸入: 輸入兩個浮點數(shù) 輸出: 輸出兩個浮點數(shù)的和、差、積。 輸入樣例: 輸出樣例: 提示: 來源:include iostreaminclude include using namespace std。void Math(float a,float b){ float sum,sub,pro。 sum=a+b。 sub=ab。 pro=a*b。 cout sum sub pro endl。}int main(){ float a,b。 cin a b 。 Math(a,b)。 return 0。} 示例代碼includeiostreamusing namespace std。void Math(float a , float b ,floatamp。 sum,float amp。sub,floatamp。pro){ sum = a+ b 。 sub = ab 。 pro = a*b 。}int main(){float sum = 0 。float sub = 0 。float pro = 0 。float a = 0 。float b = 0 。 cinab。 Math(a,b,sum,sub,pro)。 coutsum sub proendl。return 0 。} 實驗題目(共4題, 第3題)標題: 3. 函數(shù)模板 時 限: 1000 ms 內存限制: 10000 K 總時限: 3000 ms 描述: 設計一個函數(shù)模板,實現(xiàn)兩個同類型數(shù)據(jù)的交換。 將設計好的函數(shù)模板分別實例化為兩個整型數(shù)交換、兩個字符交換的模板函數(shù),調用這些函數(shù)并輸出運行結果。 輸入: 分別輸入兩個整型數(shù)和兩個字符 輸出: 分別輸出兩個整型數(shù)和兩個字符交換的結果 輸入樣例: 5 9 輸出樣例: 9 5 提示: 來源:include iostreamusing namespace std。template class Type Type huan(Type a,Type b){ Type c。 c=a。 a=b。 b=c。 cout a 39。 39。 b endl。}int main(){ int a,b。 cin a b 。 huan(a,b)。 char c,d。 cin c d。 huan(c,d)。 return 0。}示例代碼includeiostreamusing namespace std。templateclass TT cg(T amp。a ,Tamp。 b){T c 。c = a 。a = b 。b = c 。}int main(){ int a = 0 。 int b = 0 。 char c = 0 。 char d = 0 。 cinabcd。 cg(a,b)。 cg(c,d)。 couta bendlc dendl。 return 0 。}實驗題目(共4題, 第4題)標題: 4. 默認形參值 時 限: 1000 ms 內存限制: 10000 K 總時限: 3000 ms 描述: 設計一個求空間兩點距離的函數(shù),要求第2個點的默認值為坐標原點。 輸入: 兩個點的坐標。 輸出: 輸出第一個點與原點之間的距離及輸入的兩個點之間的距離。 輸入樣例: 1 1 15 5 5 輸出樣例: 提示: 函數(shù)原型可設計如下:float distance(float x1,float y1,float z1, float x2=0,float y2=0,float z2=0)。 來源: include iostreaminclude include include using namespace std。float distanceyuan(float x1,float y1,float z1, float x2=0,float y2=0,float z2=0){ float ju1。 ju1=sqrt(x1*x1+y1*y1+z1*z1)。 return ju1。}float distanceliang(float x1,float y1,float z1, float x2,float y2,float z2){ float ju2,a,b,c。 a=x1x2。b=y1y2。c=z1z2。 ju2=sqrt(a*a+b*b+c*c)。 return ju2。}int main(){ float x,y,z,w,m,n,ju1,ju2。 cin x y z。 cin w m n。 ju1=distanceyuan(x,y,z)。 ju2=distanceliang(x,y,z,w,m,n)。 cout ju1 endl ju2 endl。 return 0。}示例代碼includeiostreamincludecmathusing namespace std。float distance(float x1,float y1,float z1,float x2=0,float y2=0,float z2=0){ return sqrt(pow(x1x2,2)+pow(y1y2,2)+pow(z1z2,2))。}int main(){ float x1 = 0 。 float x2 = 0 。 float y1 = 0 。 float y2 = 0 。 float z1 = 0 。 float z2 = 0 。 cinx1y1z1x2y2z2。 coutdistance(x1,y1,z1)endl。 coutdistance(x1,y1,z1,x2,y2,z2)endl。 return 0 。}實驗題目(共2題, 第1題)標題: 類的定義_靜態(tài)常量 時 限: 100
點擊復制文檔內容
試題試卷相關推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1