+ 1

how to use structure in functions

struct dam { string name; string city; float capacity; float filled_space; int employee_num; struct dammanager manager; //pointer manager }; int main() { int num = 2 ; struct dam dams; cout << "please enter how many dam you want to add ?" << endl; cin >> num; //dams = new dam[num]; get_information(dams.manager.name, dams.manager.last_name, dams.manager.phone, dams.manager.age, dams.dam_name, dams.city, dams.capacity, dams.filled_space, dams.employee_num, num); //delete[] dams; return 0; } whats my problem i dont understand how should i put ? i want to use both dynamic array and structure in function

20th Jan 2020, 7:22 PM
motahareh
motahareh - avatar
1 ответ
+ 1
Hello, struct is mostly used in C. But i think that it's the same with classes in C++. If you are in C++, it would be easier to use OOP with the classes because classes are easier to manage
21st Jan 2020, 8:33 AM
Marc Oukass Gomis
Marc Oukass Gomis - avatar