某高校教师的课酬计算方法是:教授100元/小时,副教授80元/小时,讲师60元/小时,助教40元/小时。编写计算教师课酬的程序,从键盘输入教师的姓名、职称、授课时数,然后输出该教师应得的课酬。
请完善下面的程序:
#include <iostream>
#include <string>
using namespace std;
int main()
{
const int js=100,fjs=80,jshi=60,zj=40;
string name;
string title;
int hour;
double wage;
cout<<"please input name,title(js,fjs,jshi,zj),hour:"<<endl;
//你的代码将被嵌在这里
return 0;
}
Sample Input
Lili fjs 90
Sample Output
please input name,title(js,fjs,jshi,zj),hour: the wage is :7200
解题:
cin>>name>>title>>hour;
//判断输入的职称
if("js"==title){cout<<"the wage is :"<<js*hour<<endl;}
else if("fjs"==title){{cout<<"the wage is :"<<fjs*hour<<endl;}}
else if("jshi"==title){{cout<<"the wage is :"<<jshi*hour<<endl;}}
else if("zj"==title){{cout<<"the wage is :"<<zj*hour<<endl;}}