// pgm6 -- reading in data from the keyboard using cin // Employee Payroll Program version 1 (2 employees) // 9/12/16 #include #include using namespace std; int main() { // define variables string first, last; int idnum; double rate,hours,pay; // read in data cout << "Enter employee #1's first name: "; cin >> first; cout << "Enter last name: "; cin >> last; cout << "Enter id number: "; cin >> idnum; cout << "Enter hours worked and rate of pay: "; cin >> hours >> rate; // calculate pay pay = hours * rate; // print everything cout << "Name: " << first << ' ' << last << " id: " << idnum << " Hours: " << hours << " rate: " << rate << endl; cout << "pay for this employee is: " << pay << endl; // now do for second employee // read in data cout << "Enter employee #2's first name: "; cin >> first; cout << "Enter last name: "; cin >> last; cout << "Enter id number: "; cin >> idnum; cout << "Enter hours worked and rate of pay: "; cin >> hours >> rate; // calculate pay pay = hours * rate; // print everything cout << "Name: " << first << ' ' << last << " id: " << idnum << " Hours: " << hours << " rate: " << rate << endl; cout << "pay for this employee is: " << pay << endl; return 0; } /* not recommended to read in different data types on the same line. cout << "Enter employee's name, id, hours, rate: "; cin >> name >> idnum >> hours >> rate; */