here's my code:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
char name[30], choice;
int hours_worked;
float wage;
do
{
cout << "Employee Name: ";
cin.getline(name,30);
cout << "No of hours worked: ";
cin>>hours_worked;
cout << endl;
wage = 80.75*hours_worked;
cout << "The salary of " << name << " is " << std::fixed <<
std::setprecision(2) << wage << " pesos"<< endl << endl;
cout << "Do you want to quit? [Y/N] ";
cin >> choice;
}while (choice != 'Y' && choice !='y');
return 0;
}
when i run it the display is:
Employee Name: John Green
No of hours worked: 100
The salary of John Green is 8075.00 pesos
Do you want to quit? [Y/N]
but when i answer Y the 1st and 2nd line merges and becomes:
Employee Name: No of hours worked:
and i dont kno why. thanks in advance!