宅男噜噜噜666在线观看,国产1区二区三区,国产日韩欧美大片,国产超碰97,国产自产视频,99久久国产综合精品色伊,亚洲午夜高清

軟題庫(kù) 學(xué)習(xí)課程
當(dāng)前位置:信管網(wǎng) >> 在線(xiàn)考試中心 >> 試題查看
試題題型【分析簡(jiǎn)答題】
試題內(nèi)容

閱讀以下說(shuō)明和C++代碼,將應(yīng)填入 (n) 處的字句寫(xiě)在答題紙的對(duì)應(yīng)欄內(nèi)。
【說(shuō)明】
現(xiàn)需要統(tǒng)計(jì)某企業(yè)員工的月平均工資,即該企業(yè)本月發(fā)給員工的工資總和除以員工數(shù)。假設(shè)企業(yè)本月發(fā)給員工的工資總和為sumSalary,該企業(yè)的員工總數(shù)為employeeNumber,下面的程序代碼計(jì)算該企業(yè)員工本月的平均工資,其中需要處理employNumber為0的情況。
【C++代碼】
#include
using namespace std;
class Department{
protected:
float   average(float   x ,int  y)  {
if (y = =0) throw    (1);
return  x/y;
}
public:
void  caculate(void)  {
float sumSalary;
int    employeeNumber;
try {
cout << "請(qǐng)輸入當(dāng)月工資總和與員工數(shù):" << end1;
cin  >> sumSalary  >> employeeNumber;
float  k=average(sumSalary,employeeNumber);
cout  << "平均工資: "<< k << end1;
}
(2)(int e) {
if(e = =0) {
cout << "請(qǐng)重新輸入當(dāng)月工資總和與員工數(shù) :" << end1;
cin  >>  sumSalary  >>  employeeNumber;
float k =average(sumSalary,employeeNumber);
cout  << "平均工資: "<< k << end1;
}
}
}
};

void  main ( ) {
try  {
(3);
d.caculate ( );
}
(4)(int  e) {
if  (  e = = 0)
cout << "程序未正確計(jì)算平均工資! " << end1;
}
}
【問(wèn)題 1】
程序運(yùn)行時(shí),若輸入的員工工資總和為6000,員工數(shù)為5,則屏幕輸出為:
請(qǐng)輸入當(dāng)月工資總和與員工數(shù):
6000 5
(5)
【問(wèn)題 2】
若程序運(yùn)行時(shí),第一次輸入的員工工資總和為6000,員工數(shù)為0,第二次輸入的員工工資總和為0,員工數(shù)為0,則屏幕輸出為:
請(qǐng)輸入當(dāng)月工資總和與員工數(shù):
6000 0
(6)
0 0
(7)

查看答案

相關(guān)試題