in the program listed below, when compiled, its still outputting errors in the f
ID: 3638054 • Letter: I
Question
in the program listed below, when compiled, its still outputting errors in the final data output. See results below as i ask of your assistance to help me figure out why this occurring? I added a system pause to it, but still outputs error, see below....Thanks...
#include
using namespace std;
class employee
{
private:
int id, maxHours;
float payRate;
public:
void setInfo (int pin, float pay, int hours)
{
id = pin;
payRate = pay;
maxHours = hours;
}
void viewInfo () // No parameters req.
{
cout << id;
cout << endl << payRate;
cout << endl << maxHours;
cout<<"enter the new valuse for the id:"<cout << "Enter employee 3 digit ID: ";
cin >> pin;
cout << "Enter employee pay rate: ";
cin >> pay;
cout << "Enter employee max hours: ";
cin >> hours;
empInfo[pin].setInfo(pin, pay, hours);
}
};
int main ( )
{
int pin, hours, record;
float pay;
int ch;
char ans;
employee empInfo[1000];
cout<<"1.ADD EMP 2.MODIFY EMP 3.DELETE EMP 4.EXIT";
cout<<"enter the choice";
cin>>ch;
switch(ch)
{
case 1:
{
cout << "Enter employee 3 digit ID: ";
cin >> pin;
cout << "Enter employee pay rate: ";
cin >> pay;
cout << "Enter employee max hours: ";
cin >> hours;
empInfo[pin].setInfo(pin, pay, hours);
}
case 2:
{
cout << "Enter the employee ID# of the record you wish to modify ";
cin >> record;
empInfo[record].viewInfo();
}
case 3:
{
cout << "Enter the employee ID# of the record you wish to modify ";
cin >> record;
empInfo[pin].setInfo("","","");
}
case 4:
{
system ("pause");
return 0;
}
}
----------------------------
Data Output
identifier
1>c:usersderrickdocumentsisual studio 2010projectsex104q8partcex104q8partc.cpp(86): error C2664: 'employee::setInfo' : cannot convert parameter 1 from 'const char [1]' to 'int'
1> There is no context in which this conversion is possible
1>c:usersderrickdocumentsisual studio 2010projectsex104q8partcex104q8partc.cpp(94): fatal error C1075: end of file found before the left brace '{' at 'c:usersderrickdocumentsisual studio 2010projectsex104q8partcex104q8partc.cpp(46)' was matched
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Explanation / Answer
change this statement empInfo[pin].setInfo("","",""); to empInfo[pin].setInfo(0,0,0);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.