Question: I have a programming problem I have been working on all day, and I have posted questions on forums with nothing but negative results and

I have a programming problem I have been working on all day, and I have posted questions on forums with nothing but negative results and comments from others. Yes, I am still new to C++ and I am doing my best to learn the material and apply it in a way that not only works, but makes sense. That being said it is most likely my unfamiliarity with C++ that has led to my problem (according to those that commented on my forum posts). Everything in my program is operating perfectly except for one function. The "swap2" function in my Course_Directory.cpp will not work and throws an error "error: terminate called after throwing an instance of 'std::length_error' what() basic_string::_M_create" and prematurely exits the program. I have tried setting the value to a temporary variable, and I've tried using swap() with no luck. Could someone please help me get this last function to work? If it is not possible with the way I have the code written, could someone help me with getting the proper code in place so that the function will operate correctly? I will include the .cpp and .h files for reference.

I have a programming problem I have been working on all day,and I have posted questions on forums with nothing but negative resultsand comments from others. Yes, I am still new to C++ andI am doing my best to learn the material and apply itin a way that not only works, but makes sense. That beingsaid it is most likely my unfamiliarity with C++ that has ledI apologize for how long all of the code is. As a requirement for this assignment everything has to be handled outside of the main.cpp. I've tried everything I can think of, and I am feeling overwhelmed and extremely frustrated. Any help with this matter would be nearly invaluable at this point! Thank you in advance.

1 2 3 4 5 #ifndef COURSE DIRECTORY H #de fine COURSE DIRECTORY H #include using namespace std; class Course Directoryi 7 8 9 10 private: int* numberOfDepts string filename; char courseName [1000] int courseNum; int numStudents; int IDs [10001 int choice, 12 13 14 15 16 17 18 19 20 21 public Course Directory) //Course Directory (Gonsi Course Directorys original) Course Directory) void run (string) void displayMenu) void coursesInDept (string) void studentsInCourse) void largestClass O; void swap2 ) void schedule ) void printAllCourses ) 23 24 25 26 27 28 29 30 #endif //COURSE DIRECTORY H

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!