hi i was writing a simple program i got from a tutorial that i was trying to modify. I have a structure that contains the name age and length of employees. I want the program to ask the user how many employees data they would like to add and then ask the information for the structures.
Here is my code:
Thanks for anyones helpCode:#include <fstream.h> struct employee //structure for employee data { char name[80]; int age; float length; }; void main() { int workers; cout << "How many workers would you like to add? "; cin >> workers; employee worker[workers]; // <----- why cant this work for(int member = 0; member < workers; member++) { cout << "Employee # " << member << ". \n"; cout << "Enter name:"; cin >> worker[member].name; cout << "Enter age:"; cin >> worker[member].age; cout << "Enter length:"; cin >> worker[member].length; } cout << "Thank you \n"; }