How to insert many inputs in the same line?

Make a C++ Program that will use nested if else and any looping statement to display the following a certain number of times depending on how many times the user wants it to do so.

Input Values:
1. Name of employee
2. Position in the company
3. No. of hours worked
4. Rate per hour
5. Overtime hours

Required Output:
No.  Name  Position  Rate per  No. of hours  Basic  No. of overtime  Overtime
                       hour      worked      Pay         hours       Pay
1.   Juan  Manager   160       140           22400  10               2100

basic pay = no. hours worked x rate per hour
overtime = overtime hours x 150% of rate per hour

Just asking how can I input the name, position, rate per hour, overtime hours and hours worked in a horizontal manner?
Because I need to achieve the required output.
Been trying to search the net but I can't understand some of the explanations.
I'am just new to programming. I need a c++ code.

Can someone explain it to me in a newbish way? :)
Last edited on
One way would be to place the equivalent of those five data headings in a structure (struct) called say 'employee'. 1. Name of employee would be identified in the struct definition as:- char * name[20]; 2. Position in the company might be defined as:- int mgr_grade;//9 - 14 say. 3. No of hours worked :- double w_hours=0;4. Rate per hour=0:5. - double ot_hours = 0; and so on.
Now in main() create one or more employee objects.
employee_1 = {"Juan", 10, 56, 55,15}; // comma separated initializer
You would need to define some methods to calculate basic pay and o/t pay
and also a say show() function which would print out the details for each employee in the proper order.
Topic archived. No new replies allowed.