Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ classes HELP. I have this coding homework and I dont understand what it is wanting differently. It is a program that reads in a

C++ classes HELP. I have this coding homework and I dont understand what it is wanting differently. It is a program that reads in a file that is basically a course directory states how many classes are in the file then, class code [like MATH or EECS], then code number, number of students and then all student id's for that class. I thought that the section where it is reading in the file would work but it is saying the courses.[blah] has not been declared.... So not sure what I should do... in order is the executive.cpp file, then exectutive.h and then main.cppimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

image text in transcribed

253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 printall); swap (courses [firstIndex].courseName, courses [secondIndex].courseName); void Executive:schedule int ID; cout > ID; cout > dept; 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 for (int i0i courseNo; cout > dept2 for (int j 0; j courseNo2 for ( int x=; x max) max courses [1] .numStudents; for(int i- 0: i department; for(int i0: i courseNum; for ( int =0; > option; while (option >7 I option > option: if (option1) printall ) 37 38 39 40 41 42 43 while (getline (file, line)) i 0: char str = const cast-char>(line. c str ( ) token= strtok (str, " "); while (token NULL) 45 46 47 48 49 50 51 52 53 54 if (j-0) strcpy (courses[i].courseName, token) else if (j - 1) courses[i].courseNum-atoi (token) else if(j-2) 56 57 58 59 60 61 62 63 64 65 courses [i].numStudentsatoi (token): else courses [1]. IDs [j - 3] = atoi (token); token = strtok (NULL, " "); 67 68 69 70 71 72 73 file.close ) include"executive.h" #include #include #include #include #include sstream> #include 2 7 9 10 using namespace std; Executive::Executive (string n) 12 13 14 15 16 17 18 19 20 21 EileNamen; Executive courses courses.courseName courses.courseNum; courses.numStudents: courses. IDs: void Executive::run () 23 24 25 26 27 28 29 30 31 32 int num courses: int i 0 int //Reading information from file ifstream file: file.open (fileName) file >> num courses; char *token; if (file.fail 0) 34 35 36 37 string line, temp; while (getline (file, line)) #1fndef EXECUTIVEH #define EXECUTIVE H #include #include #include "executive . h" using namespace std; int main( int argc, char* argv[]) if(argc > ID; cout > dept; 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 for (int i0i courseNo; cout > dept2 for (int j 0; j courseNo2 for ( int x=; x max) max courses [1] .numStudents; for(int i- 0: i department; for(int i0: i courseNum; for ( int =0; > option; while (option >7 I option > option: if (option1) printall ) 37 38 39 40 41 42 43 while (getline (file, line)) i 0: char str = const cast-char>(line. c str ( ) token= strtok (str, " "); while (token NULL) 45 46 47 48 49 50 51 52 53 54 if (j-0) strcpy (courses[i].courseName, token) else if (j - 1) courses[i].courseNum-atoi (token) else if(j-2) 56 57 58 59 60 61 62 63 64 65 courses [i].numStudentsatoi (token): else courses [1]. IDs [j - 3] = atoi (token); token = strtok (NULL, " "); 67 68 69 70 71 72 73 file.close ) include"executive.h" #include #include #include #include #include sstream> #include 2 7 9 10 using namespace std; Executive::Executive (string n) 12 13 14 15 16 17 18 19 20 21 EileNamen; Executive courses courses.courseName courses.courseNum; courses.numStudents: courses. IDs: void Executive::run () 23 24 25 26 27 28 29 30 31 32 int num courses: int i 0 int //Reading information from file ifstream file: file.open (fileName) file >> num courses; char *token; if (file.fail 0) 34 35 36 37 string line, temp; while (getline (file, line)) #1fndef EXECUTIVEH #define EXECUTIVE H #include #include #include "executive . h" using namespace std; int main( int argc, char* argv[]) if(argc

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Performance Indexing In SQL Server

Authors: Jason Strate, Grant Fritchey

2nd Edition

1484211189, 9781484211182

More Books

Students also viewed these Databases questions

Question

OUTCOME 2 Describe how a training needs assessment should be done.

Answered: 1 week ago