Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ help fix my dynamic array program #include #include #include #include #include using namespace std; struct Classes { string names; //Holds names of the students

C++ help fix my dynamic array program

#include  #include  #include  #include  #include  using namespace std; struct Classes { string names; //Holds names of the students string *courses; //Number of students int num; //Holds the courses the student is taking }; int main(int argc, const char * argv[]) { fstream fin; fin.open ("courses.txt"); int size; //Number of students fin >> size; Classes * a = new Classes[size]; //Array of struct which holds a students name and classes char el; fin.get(el); for (int ct = 0; ct > a[ct].num; a[ct].courses = new string [a[ct].num]; //Array that holds a student courses for ( int ct2=0; ct2 > a[ct].courses[ct2]; } fin.get(el); } cout > choice; while (choice != 'Q') { if (choice == 'D') { cout > courses; cout > choice; } system("pause"); } 

courses.txt looks like this:

12

John Milligan

3 CIS100 CIS105 MAT113

Jill Kerning

5 CIS100 CIS105 MAT232 BIO100 ENG101

Aaron Spencer

4 CIS201 CIS225 MAT232 ENG101

Damon Hill

2 CIS334 CIS400

Kaitlyn Stamen

4 CIS100 CIS10 MAT113 BIO100

Debbie Martin

5 CIS100 CIS105 MAT232 CHY112 ENG101

Greg Nolan

2 CIS334 CIS450

Lynn Sanders

4 CIS334 CIS450 MAT250 BIO100

Alicia Thomas

4 CIS226 CIS450 MAT232 CHY112

Alan Turner

5 CIS100 CIS105 MAT232 BIO100 ENG101

Paul Henley

5 CIS100 CIS105 CIS334 ENG101 MAT232

Tim Copeland

1 CIS450

End result should look like this:

image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

2. What process will you put in place to address conflicts?

Answered: 1 week ago