1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
// Example program
#include <iostream>
#include <string>
#include <iomanip>
#include <vector>
struct Employee {
std::string name;
double hours_worked;
double pay_rate;
};
int main()
{
std::vector<Employee> employees {
{"Johnson", 60, 12.50},
{"Aniston", 65, 13.25},
{"Cooper", 50, 14.50},
{"Bronson", 60, 20.00},
{"Sunny", 65, 18.75},
{"Smith", 30, 9.75}
};
for (const auto& employee : employees)
{
std::cout << std::setw(10) << std::left << employee.name << ' '
<< employee.hours_worked << ' ' << employee.pay_rate << '\n';
}
}
|