Hello again to good ol' DaniWeb. Again I'm stuck. I'm a newbie when it comes to C++. I was given an assignment (ATTACHED), which I'm having problems with in the first part of Menu Choice A section. I'm only that far, and haven't proceeded further. I've coded the following (with some of the future code empty, but placed so I can know my basic structure):
/** This program calculates the weekly salaries of 4 employees
and accumulates non-paid time **/
#include <iostream>
#include <iomanip>
int main()
{
// variables
int input_loop = 0;
int hours[4][5] = {{8,9,11,8,10},
{12,7,12,11,12},
{8,9,10,9,6},
{8,7,8,6,6}}; // array to store hours
int* hours_ptr; // hours pointer
double hourly_wage[3]; // array to store hourly wage input
char cont = ' '; // continue selector
char choice = ' '; // menu choice selector
char empl_name[4][16] = {"Berkley Boyd",
"Camden Caelan",
"Greer Gregor",
"Maisie Macaulay"}; // array to store employee names
char* empl_name_ptr; // employee name pointer
do
{
cout << "Welcome to Star Enterprise Salary Program " << endl;
cout << "===========================================" << endl;
cout << "A - Enter hourly rate for each employee " << endl;
cout << "B - Calculate work hours and weekly salary " << endl;
cout << "C - Display non-paid time for each employee" << endl << endl;
cout << "Please enter your choice: " << endl;
cin << choice;
cout >> endl;
if(choice == 'a' || choice == 'A')
{
for(input_loop = 0; input_loop < 4; ++input_loop)
cout << "Please enter the hourly rate for " << empl_name_ptr[0] + 1 << ": " << endl;
cin >> hourly_wage[hours];
}
else if(choice == 'b' || choice == 'B') // menu choice B calculate work hours & salary
{}
else if(choice == 'c' || choice == 'C') // display non-paid time accumulation
{}
else // incorrect choice
{
cout << "Incorrect Selection! Please re-enter!" << endl;
}
}
while (cont == 'Y'); // loop choice to continue program
return 0;
}
Right now what I'm confused about is getting the input from the hourly wage loop. I probably named the loop wrong also. Anyhow, I know that I'm supposed to used the char array of names to supplement the name of the employee, and the get the "hourly_wage" input to store the wage of that employee to later calculate the salary. If I'm getting ahead of myself or if I should clarify myself, please feel free to. Basically, how close is my syntax so far. It should look like the sample output attached.
Thanks in advance for your help. I greatly appreciate it. Any help, criticism or suggestions are welcome.
TG