Generation

generate functionThu, 26 Jan 2023

Use 4D arrays to show the working on a company

#include <iostream> #define COLS 4 // change to 6 for the challenge #define ROWS 5 using namespace std; int main() { int employees[ROWS][COLS]; for (int i = 0; i < ROWS; i++) { for (int j = 0; j < COLS; j++) { cout << "Enter employee " << i + 1 << "'s "; switch (j) { case 0: cout << "ID: "; break; case 1: cout << "age: "; break; case 2: cout << "years of service: "; break; case 3: cout << "salary: "; break; } cin >> employees[i][j]; } } cout << "Employee\tID\tAge\tYears\tSalary\n"; for (int i = 0; i < ROWS; i++) { cout << i + 1 << "\t\t"; for (int j = 0;

Questions about programming?Chat with your personal AI assistant