TASK
Open
Reward › Contribution Review
Find bug
#include<iostream>
using namespace std;
class Employee
{
public:
string nme,dgs;
int rank;
void emply_data()
{
cout<<"Enter your Name";
cin>>nme;
cout<<"Enter your Rank";
cin>>rank;
cout<<"Enter your Designation";
cin>>dgs;
}
void clcultion()
{
switch(rank)
{
case 1:
cout <<nme,dgs,10000 << endl;
break;
case 2:
cout <<nme,dgs,20000 << endl;
break;
case 3:
cout << nme,dgs,30000 << endl;
break;
default:
cout << "Invalid Input!" << endl;
break;
}
}
};
main()
{
Employee b1;
b1.emply_data();
b1.clcultion();
}
Like
Award Contribution
I see
Employee b1;
But no new instance creation of an Employee assigned to b1.
Employee b1;
b1 must be initialize with new Employee() e.g.
Employee b1 = new Employee();
JOIN TASK
LEAVE A REPLY
DISCOVER
HIRE
ACTIVITY
FEED