Answer to Question #259097 in C++ for vinno

Question #259097

Write a program that keeps track of a speakers’ bureau. The program should use a structure to store:

 Name

Telephone Number

Speaking Topic

Fee Required

Add functions to set the values of data members and add function show values as well,The program should use an array of at least 10 structures. It should let the user enter data into the array, change the contents of any element, and display all the data stored in the array.

The program should have a menu-driven user interface.

Search Function for the Speakers’ Bureau Program that allows the user to search for a speaker on a particular topic. It should accept a key word as an argument and then search the array for a structure with that key word in the Speaking Topic field. All structures that match should be displayed. If no structure matches, a message saying so should be displayed.

Input Validation: When the data for a new speaker is entered, be sure the user enters data for all the fields. No negative amounts should be entered for a speaker’s fee. 



1
Expert's answer
2021-10-31T00:15:54-0400
#include <iostream>
#include <string>
#include <iomanip>


using namespace std;


struct speakerBureau
{
string name;
string TelephoneNumber;
string SpeakTopic;
int fee;
};


void getSpeaker(speakerBureau *);
void printSpeaker(speakerBureau *);
void editSpeaker(speakerBureau *);
void searchSpeakTopic(speakerBureau*);


int main()
{
int NUM_SPEAKERS = 10;
int index;
speakerBureau info[10];




int menu;
const int enter = 1,
change = 2,
print = 3,
search = 4,
leave = 5;




do{
cout << "Please select a choice from the menu.\n"
<< "1) Enter Speaker Information.\n"
<< "2) Change Speaker Information.\n"
<< "3) Print Speaker Information.\n"
<< "4) Search for Topic. \n"
<< "5) Leave this menu.\n"
<< "Select: ";
cin >> menu;


switch (menu)
{
case enter:
{


getSpeaker(info);
}
break;
case change:
{


editSpeaker(info);
}
break;
case print:
{


printSpeaker(info);
}
break;


case search:
{
searchSpeakTopic(info);
}
}
} while (menu != leave);


system("pause");
return 0;
}
void getSpeaker(speakerBureau *p)
{




int i = 0;
int size = 10;
for (i = 0; i < size; i++)
{
cout << "Please enter the following information of speaker " << i << " : \n";
cout << "Speaker Name:";
cin.ignore();
getline(cin, p[i].name);
cout << "\nSpeaker Telephone Number:";
cin.ignore();
getline(cin, p[i].TelephoneNumber);
cout << "\nSpeaker Topic:";
cin.ignore();
getline(cin, p[i].SpeakTopic);
cout << "\nFee Required:";
cin >> p[i].fee;
}
}


void printSpeaker(speakerBureau *p)
{
int i = 0;
int size = 10; 
for (i = 0; i < size; i++)
{
cout << "The information entered for each speaker is: \n";
cout << "Speaker " << i << endl;
cout << "Speaker Name: " << p[i].name << endl;
cout << "Speaker Telephone Number: " << p[i].TelephoneNumber << endl;
cout << "Speaker Topic: " << p[i].SpeakTopic << endl;
cout << "Speaker Fee Required: " << p[i].fee << endl;
}
}




void editSpeaker(speakerBureau *p)
{
int i;
cout << "Please enter the number of the speaker you would like to edit."
<< endl;
cin >> i;
if (i <= 9)
{
cout << endl;
cout << "Please enter the updated information of the speaker: \n";
cout << "Speaker Name:";
cin.ignore();
getline(cin, p[i].name);
cout << "\nSpeaker Telephone Number:";
getline(cin, p[i].TelephoneNumber);
cout << "\nSpeaker Topic:";
getline(cin, p[i].SpeakTopic);
cout << "\nFee Required:";
cin >> p[i].fee;
}
else
{
cout << "Please pick a number between 0-9" << endl;


}
}


void searchSpeakTopic(speakerBureau*p)
{
int i = 0;
int topic;


cout << " Please type a topic in the program" << endl;


cin >> topic;




}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS