Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SpeaksBureauCool.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <iomanip>
- using namespace std;
- struct Speaks
- {
- char Name[30];
- int Telephone;
- char Topic[100];
- double Fee;
- };
- void Menu(int NUM_SPEAKIERS,Speaks speakIers[]);
- void showSpeakers(int NUM_SPEAKIERS,Speaks speakIers[])
- {
- cout<<endl;
- for(int i =1;i<NUM_SPEAKIERS+1;i++)
- {
- cout<<endl;
- cout<<"Speaker "<<i<<".\n";
- cout<<speakIers[i-1].Name<<"\t\t"<<speakIers[i-1].Topic<<endl;
- cout<<speakIers[i-1].Telephone<<"\t\t"<<speakIers[i-1].Fee<<endl;
- cout<<endl;
- }
- cout<<"Current list of speakers.\n";
- cout<<endl;
- system("pause");
- system("cls");
- Menu(NUM_SPEAKIERS, speakIers);
- }
- void editSpeaker(int NUM_SPEAKIERS,Speaks speakIers[])
- {
- cout<<endl;cout<<endl;cout<<endl; //cleanfill
- int speakerEditPick = 0;
- for(int i =1;i<NUM_SPEAKIERS+1;i++)
- {
- cout<<endl;
- cout<<"Speaker "<<i<<": "<<speakIers[i-1].Name<<"\t\t"<<speakIers[i-1].Topic<<endl;
- cout<<endl;
- }
- do{
- cout<<"Please enter the speaker number you wish to modify: ";
- cin>>speakerEditPick;
- cout<<endl;
- system("cls");
- }while(speakerEditPick < 1 || speakerEditPick > 10);
- cout<<"You have chosen to modify speaker "<<speakerEditPick<<".\n";
- cout<<endl;
- //get the new speakers name
- cout<<"Enter Speaker "<<speakerEditPick<<"'s Name: ";
- cin>>speakIers[speakerEditPick-1].Name;
- //get the new speaker's phone numbers
- cout<<"Enter speaker's phone number (integers only): ";
- cin>>speakIers[speakerEditPick-1].Telephone;
- //gets the new topic for each speaker
- cout<<"Enter the topic for this speaker: ";
- cin>>speakIers[speakerEditPick-1].Topic;
- //gets the new fee speaker is charged
- cout<<"Enter speaker price: $";
- cin>>speakIers[speakerEditPick-1].Fee;
- cout<<endl;
- system("pause");
- system("cls");
- cout<<endl;
- cout<<"Speaker "<<speakerEditPick<<".\n";
- cout<<speakIers[speakerEditPick-1].Name<<"\t\t"<<speakIers[speakerEditPick-1].Topic<<endl;
- cout<<speakIers[speakerEditPick-1].Telephone<<"\t\t"<<speakIers[speakerEditPick-1].Fee<<endl;
- cout<<endl;
- cout<<"You have successfully modified the information regarding speaker "<<speakerEditPick<<".\n";
- cout<<endl;
- system("pause");
- system("cls");
- Menu(NUM_SPEAKIERS, speakIers);
- }
- void setSpeakers(int NUM_SPEAKIERS,Speaks speakIers[])
- {
- //get speaker data
- cout<<"Enter the following information on the "<<NUM_SPEAKIERS
- <<" speakers, who will be speaking at the event.\n";
- int index=0;
- for(index = 0;index<NUM_SPEAKIERS;index++)
- {
- //get the speakers names
- cout<<"Enter Speaker "<<(index+1)<<"'s Name: ";
- cin>>speakIers[index].Name;
- //get the speaker's phone numbers
- cout<<"Enter speaker's phone number (integers only): ";
- cin>>speakIers[index].Telephone;
- //gets the topic for each speaker
- cout<<"Enter the topic for this speaker: ";
- cin>>speakIers[index].Topic;
- //gets the fee speaker is charged
- cout<<"Enter speaker price: $";
- cin>>speakIers[index].Fee;
- cout<<endl;
- }
- system("pause");
- system("cls");
- Menu(NUM_SPEAKIERS, speakIers);
- }
- void Credits(int NUM_SPEAKIERS,Speaks speakIers[])
- {
- cout<<endl;cout<<endl;cout<<endl;
- cout<<"\t\t\t>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n";
- cout<<"\t\t\t^ Created by: v\n"; ///////////////////
- cout<<"\t\t\t^ -------------------- v\n"; // Sweet Menu //
- cout<<"\t\t\t^ Me v\n"; ///////////////////
- cout<<"\t\t\t^ Me v\n";
- cout<<"\t\t\t^ Me v\n";
- cout<<"\t\t\t<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n";
- cout<<endl;cout<<endl; //clean fill
- system("pause");
- system("cls");
- Menu(NUM_SPEAKIERS, speakIers);
- }
- void exitrlly(int NUM_SPEAKIERS,Speaks speakIers[])
- {
- char rllygo; //holds user inputted char
- cout<<"\t\t\t Leaving so soon??\n"; //title of exit page
- cout<<endl;cout<<endl; //clean fill
- cout<<"Are you sure you wish to exit the program?(y or n): "; //makes sure user wants to leave
- cin>>rllygo; //assigns user inputted choice to variable
- if(rllygo == 'y') //tests if y was entered
- {
- exit (0); //exits the program
- }
- system("cls"); //refresh screen
- Menu(NUM_SPEAKIERS, speakIers); //reloads menu
- }
- void searchTopics(int NUM_SPEAKIERS,Speaks speakIers[])
- {
- //string keyWord;?
- cout<<endl;
- cout<<"Enter a topic keyword: ";
- cout<<endl;
- cout<<"This option is not available in the free version.\n";
- cout<<endl;
- cout<<"Send me $5 for a better version.\n";
- cout<<endl;
- system("pause");
- system("cls");
- Menu(NUM_SPEAKIERS, speakIers); //reloads menu
- //cin.getline(keyWord);??
- }
- void Menu(int NUM_SPEAKIERS,Speaks speakIers[])
- {
- system("cls");
- int menuChoice = 0; //initialized to 0, holds menu selection of user
- do //loops the menu - handles out of range integer input
- {
- cout<<endl;cout<<endl;cout<<endl;
- cout<<"\t\t\t>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n";
- cout<<"\t\t\t^ 1 - Initialize All Speakers v\n"; ///////////////////
- cout<<"\t\t\t^ 2 - Edit Individual Speaker v\n"; // Sweet Menu //
- cout<<"\t\t\t^ 3 - Display Speaker List v\n"; ///////////////////
- cout<<"\t\t\t^ 4 - Search Topics v\n";
- cout<<"\t\t\t^ 5 - Credits v\n";
- cout<<"\t\t\t^ 6 - Exit v\n";
- cout<<"\t\t\t<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n";
- cout<<endl;cout<<endl; //clean fill
- cin>>menuChoice; //assigns user selection to variable
- if(menuChoice == 1) //tests for option 1 selection
- {
- system("cls"); //resets screen
- setSpeakers(NUM_SPEAKIERS, speakIers);
- }
- if(menuChoice == 2) //tests for option 2 selection
- {
- system("cls"); //refreshes screen
- editSpeaker(NUM_SPEAKIERS, speakIers);
- }
- if(menuChoice == 3) //tests for option 3 selection
- {
- system("cls"); //refreshes screen
- showSpeakers(NUM_SPEAKIERS, speakIers);
- }
- if(menuChoice == 4) //tests for option 4 selection
- {
- system("cls"); //refreshes screen
- searchTopics(NUM_SPEAKIERS, speakIers);
- }
- if(menuChoice == 5) //tests for option 5 selection
- {
- system("cls"); //refreshes screen
- Credits(NUM_SPEAKIERS, speakIers);
- }
- if(menuChoice == 6) //tests for option 5 selection
- {
- system("cls"); //refreshes screen
- exitrlly(NUM_SPEAKIERS, speakIers);
- }
- }while(menuChoice < 1 || menuChoice > 6); //loop handler for menuchoices not available
- }
- int main(int argc, char* argv[])
- {
- const int NUM_SPEAKERS = 10; //number of speakers
- Speaks speakers[NUM_SPEAKERS]; //array of structures
- Menu(NUM_SPEAKERS, speakers);
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment