hi. i have a program that i am having some troubles with. if anyone could give me any suggestions, it would be greatly appreciated! : )

i have to edit the main some more to get this to actually work. and i also have to add info into the function.

#include <iostream>
#include <string>

using namespace std;

const int MAXIMUM = 100;

// YOUR FUNCTION HERE
int findMe ()
{
}

int main ()
{
	string names[MAXIMUM];
	double score[MAXIMUM];

	for (int x = 0; x < MAXIMUM; x++)
	{
		cout << "Please enter a student name (Enter a blank to stop): ";
		getline(cin, names[x]);
		cout << "Please enter this student's score: ";
		cin >> score[x];
		cin.ignore();
	}

	cout << endl << "*****************" << endl;

	while (true)
	{
		string lookmeup;
		double tmpscore;
		cout << "Enter a name to look up: ";
		getline(cin, lookmeup);
		if (findMe(lookmeup, names, score, tmpscore))
			cout << lookmeup << " has a score of " << tmpscore << endl;
		else
			cout << lookmeup << " was not found." << endl;
	}
}

HERE IS SOME SAMPLE OUTPUT:

Please enter a student name (Enter a blank to stop): Adam
Please enter this student's score: 11.11
Please enter a student name (Enter a blank to stop): Betty
Please enter this student's score: 22.22
Please enter a student name (Enter a blank to stop): Charlie
Please enter this student's score: 33.33
Please enter a student name (Enter a blank to stop): Debbie
Please enter this student's score: 44.44
Please enter a student name (Enter a blank to stop): Elaine
Please enter this student's score: 55.55
Please enter a student name (Enter a blank to stop):

*****************
Enter a name to look up: Adam
Adam has a score of 11.11
Enter a name to look up: Elaine
Elaine has a score of 55.55
Enter a name to look up: Bob
Bob was not found.
Enter a name to look up: Charlie
Charlie has a score of 33.33
Enter a name to look up:
Press any key to continue . . .

what part of findMe () don't you know how to code ? Look at this line and you will see what parameters it needs to have. All parameters should be passed by reference. if (findMe(lookmeup, names, score, tmpscore))

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