I have a hw problem that has me baffled. Im sure It is not a big deal, i just am not that familiar with c++ yet.
I am tasked with assigning a char value to rate an employee
if I enter certain char's i should display a specified string.
and if the display is invalid I am to display that it was and to try again.
seems simple but It is beating me up.
First when I enter the char with cin>> the loop continously runs until i close the console.
second I am not even sure it is executing the strings if i enter a specified char.
Please help me.
#include <cstdlib>
#include <iostream>
using namespace std;
void GetRating(int x);// function prototype
int value;
int x=0;
int main ()
{
for (x=0;x==0;)
{cout<< "Enter employee rating"<<endl;
cout<< "use E, G, A or P: "<<endl;
cin>>value;
GetRating(x);
}
system("PAUSE");
return EXIT_SUCCESS;
}
//**************************************************************************************************
void GetRating (int x)
{
if (x=='e')
cout<< " the employees rating was excellant"<<endl;
else if (x == 'g')
cout<< " the employees rating was good"<<endl;
else if (x=='a')
cout<< " the employees rating was average"<<endl;
else if (x=='p')
cout<< " the employees rating was poor"<<endl;
else
cout<< "Rating invalid Please try again:"<<endl;
}