试题与答案

小红每次见到教自己的老师都热情地打招呼,可对不教自己的老师有时就做不到了。[ ]

题型:判断题

题目:

小红每次见到教自己的老师都热情地打招呼,可对不教自己的老师有时就做不到了。[ ]

答案:

×

试题推荐
题型:填空题

阅读以下说明和C++代码,将应填入______处的字句写在对应栏内。
[说明]
现需要统计某企业员工的月平均工资,即该企业本月发给员工的工资总和除以员工数。假设企业本月发给员工的工资总和为sumSalary,该企业的员工总数为employeeNumber,下面的程序代码计算该企业员工本月的平均工资,其中需要处理employNumber为0的情况。
[C++代码]
#include <iostream>
using namespace std;
class Department
protected:
float average(float x,int y)
if(y==0)throw ______;
return x/y;

public:
void caculate(void)
float sumSalary;
int employeeNumber;
try
cout<<"请输入当月工资总和与员工数:"<<endl;
cin>>sumSalary>>employeeNumber;
float k=average(sumSalary,employeeNumber);
cout<<"平均工资:"<<k<<endl;

______(int e)
if(e==0)
cout<<"请重新输入当月工资总和与员工数:"<<endl;
cin>>sumSalary>>employeeNumber;
float k=average(sumSalary,employeeNumber);
cout<<"平均工资:"<<k<<endl;



;
void main()
try
______;
d.caculate();

______(int e)
if(e==0)
cout<<"程序未正确计算平均工资!"<<endl;


程序运行时,若输入的员工工资总和为6000,员工数为5,则屏幕输出为:
请输入当月工资总和与员工数:
6000 5
______
若程序运行时,第一次输入的员工工资总和为6000,员工数为0,第二次输入的员工工资总和为0,员工数为0,则屏幕输出为:
请输入当月工资总和与员工数:
6000 0
______
0 0
______

查看答案
微信公众账号搜索答案