Hello,
Any time I run my program after I make a selection from the menu the output is printed on the console screen then immediately a windows screen comes up saying project.exe has stopped working. Any and all thoughts/suggestions are welcomed. Below is my code, and I suspect the error has something to either A) due with how I'm calling the method or B) how I have the method coded.
#include <iostream>
#include <fstream>
#include <string>
#include "telephone.h"
#include "tbook.h"
usingnamespace std;
int main()
{
int menuSelection; // variable for user input for the rolodex program
Tbook tbookObject;
Telephone telebookObject;
// below is listing the menu options for rolodex program
cout << "Welcome to the Rolodex-9000, please select from the following choices" << endl;
cout << "\t To Lookup a name press 1 " << endl;
cout << "\t To add a new entry press 2" << endl;
cout << "\t To print the Rolodex-900 press 3" << endl;
cout << "\t To exit, press 4 " << endl;
cin >> menuSelection;
// prompting user with menu options
switch(menuSelection)
{
case 1:
case 2:
tbookObject.isFull();
case 3:
tbookObject.print();
case 4:
tbookObject.write();
default:
cout << "Error, invalid selection. Please try again";
}
}
Remember, an array, such as int rolodex[9];, accepts numbers into rolodex[0] thru rolodex[8], only. So trying to access rolodex[9], is accessing an out-of-bounds value, and you never know what that may be. It could really screw up your program.