I know how to read a file with ifstream etc. I am just stuck on this task where I have a header file full of constants and a text file with 3 variables (budget, hotelType, [event1, event2, …, eventn]).
#ifndef CONSTANTS_H_
#define CONSTANTS_H_
const string nameMap[] = { "Opening", "Soccer 1", "Soccer 2", "Soccer 3",
"Track and Field 1", "Track and Field 2", "Track and Field 3",
"Track and Field 4", "Swimming 1", "Swimming 2", "Gymnastics 1",
"Gymnastics 2", "Basketball 1", "Basketball 2", "Closing" };
const int eventPriceMap[] = { 2000, 80, 160, 500, 80, 100, 120, 140, 100, 100, 60, 100,
150, 300, 800 };
const int eventDateMap[] = { 0, 3, 6, 9, 1, 2, 3, 4, 5, 6, 7, 8, 5, 7, 9 };
const int eventQuota[] = {60, 47, 30, 22, 50, 52, 42, 25, 37, 20, 43, 34, 35, 30, 40};
const int hotelPriceMap[] = {160, 210, 320};
const int hotelQuota[] ={20, 25, 30};// per day
const int MAXEVENTS = 10;
const int MAXREQUESTS = 150;
const int NUMBEROFEVENTS = 15;
const int NUMBEROFDAYS = 10;
#endif /* CONSTANTS_H_ */
9020,4[2,0,5,14,10,4,3,13,1]
7805,5[13,3,12,12,0,9,7,10,6,1]
7075,5[3,2,4,9,7,0,1,5,6,14]
7679,4[0,4,14,1,3,12,5,10]
6356,3[7,3]
6874,5[14,0,4,10,9,3]
4715,4[9]
4784,5[11]
4321,3[5,3,8,9]
6469,5[7,6,6,14,12,5,2]
4838,4[1,2]
4103,3[14]
5904,5[5,4,6]
5775,3[10,14,14,8,7,3,4]
7070,4[1,4,6,11,13,3,2,5,14]
4605,3[6,10,1,8,7,3,3]
7484,4[11,5,14,2,6,7,8,1,0]
Within another file how would I go about reading this text document and saving it into Budget, hotelType, and [events]. I absolutely have no idea im still learning c++, thankyou to anyone who helps!
Edit: I dont think the constants header file is necessary for this. My apologies