Code:
#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::string;
using std::endl;
//Optional function: depends on IDE. Prevents from "console flashing".
//1) Remove if not needed by IDE. 2) Remove for final release.
void wait_for_enter();
int main()
{
double payrate[4]={10.00, 11.50, 14.00, 20.00};
double hrs,pay;
int payRateCode;
for (int i = 0; i < 5; ++i)
{
cout<<"Enter hours worked:"<<endl;
cin >> hrs;
cout<<"Enter pay rate code: (0 = 10, 1 = 11.5, 2 = 14, 3 = 20)"<<endl;
cin >> payRateCode;
pay = hrs * payrate[payRateCode];
cout << "Pay = " << pay << endl;
}
wait_for_enter();
return 0;
}
//---------------------------------------------------
void wait_for_enter()
{
cout << "press <enter> to continue...";
// Reset failstate, just in case.
cin.clear();
string line;
getline( cin, line);
}