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;
}

Edited 6 Years Ago by WaltP: Added CODE Tags

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:

First: STOP SHOUTING!!!! It's very rude
Second: Use CODE tags! Descriptions are all over this site.
Third: Explain the problem.

Start by setting the HighestCharge variable to the first speaker's value. Then test each subsequent fee and modify HighestCharge accordingly.

This article has been dead for over six months. Start a new discussion instead.