HI ALL. I'M LOOKING FOR A SOLUTION FOR MY CODE. I WANT TO FIND THE HIGHEST CHARGE AFTER AN ARRAY HAS SHOWN UP(SPEAKER'S FEE). WHAT CAN I DO??
THANKS
HERE'S MY CODE:
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
struct Bureau
{
char name[50]; // Name
char phoneNum[50]; // Phone number
char topic[50]; // Speaking topic
float fee; // Charges of speaker
};
int main()
{
Bureau person[200]; // Array of structures
int index = 0; // Loop counter
int speakers; // Number of speakers to be reserved
// Get the number of speakers to be reserved.
cout << " How many speakers need to be reserved? ";
cin >> speakers;
while (speakers < 0 || speakers > 200)
{
cout << " Please enter a valid number that do not lesser than zero or greater than two hundred. " << endl;
cin >> speakers;
}
cout << endl << endl;
for (int count = 0; count <= 50; count++)
{
// Get the information of speaker.
cout << " Bureau for speaker: " << (count + 1) << endl;
cout << " Enter the speakers name: ";
cin.ignore();
cin.getline(person[count].name, 50);
cout << " Enter the phone number of " << person[count].name << " : ";
cin >> person[count].phoneNum;
cout << " Enter the topic of " << person[count].name << " : ";
cin.ignore();
cin.getline(person[count].topic, 50);
cout << fixed << showpoint << setprecision(2);
cout << " Enter the fee of " << person[count].name << " : ";
cin >> person[count].fee;
while (person[count].fee <0) // Input Invalidation
{
cout << " Please enter a positive amount. ";
cin >> person[count].fee;
}
cout << endl << endl;
// Display a list of speaker information.
cout << " Name: " << person[count].name << endl;
cout << " Phone number: " << person[count].phoneNum << endl;
cout << " Topic: " << person[count].topic<< endl;
cout << " Fee: $ " << person[count].fee << endl << endl;
}
return 0;
}