1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
//Start of main function.
int main ()
{
int choice = 0; //Integer variable for menu choice.
bool exit = false; //Boolean value for menu exit condition.
char phraseOne[SIZE] = {0}; //Character array for phrase stored in pos 1.
char phraseTwo[SIZE] = {0}; //Character array for phrase stored in pos 2.
char phraseThree[SIZE] = {0}; //Character array for phrase stored in pos 3.
char phraseFour[SIZE] = {0}; //Character array for phrase stored in pos 2.
char signature[SIZE] = {0}; //Character array for signature entry.
char signatureNew[SIZE] = {0}; //Character array for signature edited.
welcome(); //Call to welcome function, displaying program welcome.
do { //Begin Do Loop for Main Menu Switch
menu(); //Call to menu function, displaying the main menu.
cin >> choice; //Store menu choice in choice integer.
cin.ignore (100, '\n'); //Clear input.
while (!cin >> choice) //WHILE LOOP FOR ERROR DETECTION
{
cin.clear();
cout << "\nInvalid choice, please try again: ";
cin >> choice;
cin.ignore(100, '\n');
}
switch (choice) //Initiate switch based on choice.
{
case 1: //Calls to phrase submenu.
phraseMenu(phraseOne, phraseTwo, phraseThree, phraseFour);
continue;
case 2: //Calls to signature submenu.
signatureMenu(signature, signatureNew);
continue;
case 3: //Calls to email submenu.
emailMenu(phraseOne, phraseTwo, phraseThree, phraseFour, signatureNew);
continue;
case 4: //Calls to information about the program.
about();
continue;
case 5: //Exits the program.
cout << "Goodbye...." << endl;
exit = true; //Sets exit condition true.
break;
default: //If a valid option is not entered, display error.
cout << "Please select a valid option." << endl;
} //End switch.
} while (!exit); //End do-while when exit condition is true.
return 0;
}
|