Hello! I have a question, I have been struggling with this for a bit (I welcome any constructive criticism and pointers) now, and I am pretty new to C++. I am in the process of writing a program that takes names in the format of LAST, FIRST; the it loads the names into a string array (Names[10000]). I first fill the array after reading the file, this is done in ReadFile(), the I sort the filled array in Sort(), from sort I send the sorted names (sorted by LAST names) to the AskForName(). Here I ask the user to input the desired name they would like to search for. From the AskForName(), I send the input to SearchNames(). In this function I want to determine if the name is LAST or FIRST. If LAST I load the answer into a vector. If it is FIRST I load into another vector. This is where my problem is (I think anyway), I have it started but I am not sure if its correct. Now If I am on the right track how do I get the results to the WriteOutput() function? Thank you once again and here is the files.


HEADER FILE

// PROGRAM:		Program #2-A (Revision)  |  C++ 10K NAME SEARCH
//  E-MAIL:		ppotter03@inbox.com
//    FILE:		P2-A_Functions.h

#include <string>
#include <vector>

using namespace std;

#define FILE_IN  "Names10K.txt"

/* This function will be responsible for displaying the programs name,
   objective, and introduction. */
void Objective_screen();

/* This function will search for the file that contains the specified
   data from which the program depends upon. If the file is located
   the information is stored in the specifed array and program continues. 
   If not, the program will exit. */
bool ReadFile(string Names[], int &rTotal);

/* This function uses a modified version of the 'bubble sort' to sort
   the names from the data file. */
// void bubbleSort();
void Sort(string Names[], int rTotal);

/* This function will use references to obtain the user's input from the 
   function and then store the user's input for use later. */
void AskForName(string &rUserInput);

/* This function will use the stored user input for a search objective.
   The search objective will be compared with the contents of the data
   file for matching occurences. */
void SearchNames(string Names[], int rTotal, string UserInput, vector<string> &rvFirst,
				 vector<string> &rvLast);

/* This function takes the values that were obtained from the first few 
   parts of the program, and write them to a summary file. After the data
   is written to the specified file the program will output the results to
   the screen. */
bool WriteOutput(string Names[], int rTotal);

FUNCTION

// PROGRAM:		Program #2-A (Revision)  |  C++ 10K NAME SEARCH
//  E-MAIL:		ppotter03@inbox.com
//    FILE:		P2-A_Functions.cpp

#include <iostream>				
#include <string>				
#include <fstream>  
#include <vector>

using namespace std;

// Specified data files
#define FILE_IN  "Names10K.txt"
#define FILE_OUT "Names10K_Results.txt"

void Objective_screen()
	{
	// Declared variables
	char ENTER;

	// Author, program title, and program objective.
	cout << "\n --------------------------------------------------------------   ";
	cout << "\n			C++ 10K NAME SEARCH							             ";
	cout << "\n --------------------------------------------------------------   ";
	cout << "\n			AUTHOR:		Page Lynn Potter							 ";
	cout << "\n			 CLASS:		CIS 2275									 ";
	cout << "\n	    ASSIGNMENT:		Program #2-A							     ";
	cout << "\n -------------------------------------------------------------- \n";
	
	cout << "\n This program will read 10,000 names (first and last) from a "
		 << "\n file, and store in an array. The names are counted and sorted "
		 << "\n (last, first). The user than enters in a name to search for, "
		 << "\n and the program searchs the names in the file. The search "
		 << "\n results are then reported to the user and also written to a "
		 << "\n program summary file. \n";
	cout << "\n TO BEGIN, PLEASE HIT THE ENTER KEY... \n";
	
	// Wait for user's input
	cin.get(ENTER);
}

bool ReadFile(string Names[], int &rTotal)
{	
	ifstream input;

	// c_str() to convert to char[] format
	input.open(FILE_IN); 

	if (! input)
		{
			return false;
		}

	rTotal = 0;
	
	// Counts the names in the file until it reaches the end.
	while (! input.eof())
	{
		// Read names from file using ',' for delimiter?
		getline(input, Names[rTotal]);
		
		input >> Names[rTotal];
		

		++rTotal;
	}

	input.close();

	return true;
}	
	
void Sort(string Names[], int rTotal)
{	
	// Test the unsorted array
	for (int i = 0; i < 10; ++i)
	{
		cout << "\n Unsorted First Ten Names: " << Names[i];
	} 

	string temporary;
	
	for(int A = 0; A < (rTotal - A); ++A)						
		{
		for(int B = 1; B < rTotal; ++B)							
			{
			if(Names[B - 1] > Names[B])
				{
					temporary = Names[B];							
					Names[B] = Names[B - 1];						
					Names[B - 1] = temporary;						
				}
			}
		}

	// Test the sorted array
	for (int i = 0; i < 10; ++i)
		{
			cout << "\n Sorted First Ten Names: " << Names[i];
		}
}
void AskForName(string &rUserInput)
{
	cout << "\n In CAPS, Enter In Name You'de Like To Search For:   ";
	getline(cin, rUserInput);
	cin.ignore();
	  
	
     
	 // int index = rUserInput.find(" ");
 
      //rLast = rUserInput.substr(0,index-1);
      //rFirst = rUserInput.substr(index+1);
		
}

void SearchNames(string Names[], int rTotal, string rUserInput, vector<string> 
				 &rvFirst, vector<string> &rvLast)
{
	

// Need to fix code below....

// RIGHT, DO A FOR LOOP AND GO THROUGH THE WHOLE ARRAY ONCE.
// THE TRICK WILL BE TO LOAD THE FIRST AND THE LAST NAMES AT THE SAME TIME.
// SINCE THEY ARE ALREADY SORTED (IN NAMES ARRAY) IF YOU LOAD AS YOU GO, THEY'LL
// ALREADY BE SORTED.  MAKE SENSE TO YOU???



	for (int i = 0; i < rTotal; ++i)
		{
			int pos;
			pos = Names[i].find(rUserInput);

			int sppos;
			sppos = Names[i].find(" ");

			//int pos2;
			//pos2 = Names[i].find(sppos, rUserInput);

			
			// If pos == -1 than continue, name isn't in the list.
			if( pos == -1)
				{
					continue; 
				}
			// If pos != -1 than the name is found.
			else  
				{
					
				}
			// If pos < sppos, then it's a last, push into vector.
			if( pos < sppos)
				{
					rvLast.push_back(Names[i]);	
				}
			
			// If pos > sppos, then it's a first and push into vector. 
			if( pos > sppos)
				{
					rvFirst.push_back(Names[i]);
				}
		}
	
}
			
bool WriteOutput(string Names[], int rTotal)
{
    string OutputFile = "Names10K_Results.txt";
	
	ofstream FileOutput;	

	FileOutput.open(OutputFile.c_str());								

	// Tests for output file
	if(!FileOutput)
	{
		cout << "\n		Opps! Error... Can't Locate The File \"" << OutputFile << "\"";
		cout << "\n ----------------------------------------------------- \n " << endl;
		
		return false;
	}
	else
	{
		cout << "\n Found Data Output File! \n";
		return true;
	}
	
		FileOutput << "\n --------------------------------------------------------------   ";
		FileOutput << "\n			C++ 10K NAME SEARCH							           ";
		FileOutput << "\n --------------------------------------------------------------   ";
		FileOutput << "\n			AUTHOR:		Page Lynn Potter						   ";
		FileOutput << "\n			 CLASS:		CIS 2275								   ";
		FileOutput << "\n	    ASSIGNMENT:		Program #2-A							   ";
		FileOutput << "\n -------------------------------------------------------------- \n";
		FileOutput << "\n -------------------------------------------------------------- \n";
		FileOutput << "\n		   RESULTS:												   ";  

		cout << "\n Check Output! ";
	
	
	FileOutput.close();
	
}
// END OF P2-A_Functions

DRIVER

// PROGRAM:		Program #2-A (Revision)  |  C++ 10K NAME SEARCH
//  E-MAIL:		ppotter03@inbox.com
//    FILE:		P2-A_Driver.cpp

#include <iostream>				
#include <string>				
#include <fstream>  
#include <vector>

using namespace std;

#include "P2-A_Functions.h"

int main()
{
		// Declared Variables
		string Names[10000], answer, rUserInput;
		string IN_FILE = "Names10K.txt", OUT_FILE = "Names10K_Results.txt";
		int rTotal = 0;
		vector<string> rvFirst;
		vector<string> rvLast;

		Objective_screen();

		do{
			
			bool OK = ReadFile(Names, rTotal);
			if(!OK)
				{
					cout << "\n ERROR! Can't Find The Input File: \"" << IN_FILE << "\"";
					cout << "\n .......Program Will Now Terminate....... \n";
					// If there is an error, this terminates program.
					exit(1);
				}
			else
				{
					cout << "\n SUCCESS! Found The Input File: \"" << IN_FILE << "\"";
					cout << "\n There's a Total Of " << rTotal << " Names In The File. \n" << endl;
				}
		
				
			Sort(Names, rTotal);

			AskForName(rUserInput);

			SearchNames(Names, rTotal, rUserInput, rvFirst, rvLast);
			
			SearchNames(Names, rTotal, rUserInput, rvFirst, rvLast);


			//if(result == true)
			//{
				//cout << "\n ERROR! Can't Find The Output File: \"" << OutputFile << "\"";
			//}
			//else
			//{
				//cout << "\n Opps! Error... Problem Writing To File. ";
				//exit(1);
			//}

			cout << "\n Search For More Name(s)? (YES / NO) ";
			getline(cin, answer);
			
		}while(answer == "YES");
		
	return(0);
}
// END OF C++ 10K NAME SEARCH

Let me know if there are any issues or any improvements I can make in this program so It will function properly. Thank you.

Attachments
PEELER, MARY
BRANN, JENNIFER
PACK, CHRISTINE
WALLACE, VAN
BRODT, KATHERINE
JARRELL, ELOISE
BARRON, LEONILA
ATHERTON, STANLEY
CARDWELL, RUBY
JOYCE, SHARA
GARCIA, MARY
FRYMAN, WILLIAM
GONZALES, MARY
FARIA, TRISTAN
SKINNER, DEBORAH
MOORE, LUCILLE
MICHAEL, ELIZABETH
HEICHEL, JOHN
WEST, TIMOTHY
CRAWFORD, EDWARD
CONLEY, JOSHUA
PALMER, MITCHEL
MATHIS, KEN
MCGREGOR, DEBORAH
DENLEY, FLOYD
DOWNS, ALISSA
FULLER, YOLANDA
CHAPPEL, BARBARA
WASHINGTON, THOMAS
SILVA, LOUISE
BEAVERS, HEIDI
SCHUSTER, LUZ
CALL, MARGARET
BETTERS, DANIEL
SMITH, RYAN
LANDGRAF, LINDA
BRINKMAN, CLAYTON
SEDGWICK, BRUCE
MURPHY, ADELA
NUNN, CARL
TERRY, GLENN
FOWLER, JORGE
THOMPSON, GERALD
DAVIS, ANGEL
MCMILLIAN, LAURA
KINGSLEY, MAX
NORRIS, BEATRICE
ROBINSON, KATHLEEN
THOMAS, CANDACE
HAIRE, JOANN
ROSENBAUM, LISA
HOLSTINE, TRACI
BEAMON, GEORGE
JOHNSON, KAREN
GROYS, EARLINE
LANDRETH, GARY
DAVIS, HUGH
ROSE, ROBERT
PENA, EDWINA
EVANS, CYNTHIA
GILL, MARY
SPAHN, CHRIS
JOHNSON, TIMOTHY
GARCIA, LORI
GOMEZ, JOANN
COUCH, TEODORO
PARR, MICHELLE
RASMUSSEN, HARRY
ANDERSON, MATHEW
ROGERS, GLORIA
PORTER, KRISTEN
PERRY, KENNETH
KILLIAN, LEE
DORSEY, MICHAEL
WARD, NATHAN
CHAPMAN, ERNEST
BURKE, FELICE
WARREN, MICHAEL
OLDENKAMP, DELMA
RUBY, TIMOTHY
BATTSON, COLLIN
WEITZMAN, CLAYTON
TSHUDY, MARY
SCALES, MICHAEL
DOUGLAS, GARY
TRAINO, MARILYN
KILDAY, ISABEL
FLORES, KRISTA
HANSEN, DENNIS
SANDERSON, RUTH
AYERS, KAY
TAYLOR, WILLIAM
SCHMIDT, SARAH
PONTIOUS, FRANCISCO
FAULKNER, KIMBERLY
CARPENTER, SUZANNE
MILLER, VERNICE
SMITH, EVELYN
WHITTINGTON, MICHAEL
SANCHEZ, LISA
CHAVEZ, LACEY
JEFFERSON, JOSHUA
SCHRAM, DENNIS
PRENDERGAST, ERNEST
ABREU, MARY
AKBAR, DAVID
BUCO, ANNIE
BEASLEY, JOSEPH
LEVASSEUR, YVETTE
CAVALLO, JOANN
MCENTEE, RITA
MUNRO, MITZI
MONETTE, JAMES
HAVEN, AUGUSTA
COLLETTE, NANCY
BOURGET, CORA
SORENSEN, MARSHALL
AKIN, ARTURO
CLARK, CURTIS
WINKLER, JERRY
LAVOIE, BRANDON
CHESSMAN, DIXIE
COLLELO, DORTHA
WEEKS, LESLIE
TEGELER, JASON
FREEMAN, JOEL
BROWN, THADDEUS
BYASSEE, JOSEPH
LEWIS, JANET
JOHNSON, THERESA
HAIL, ELSIE
LONGSWORTH, EARNEST
LOWELL, CHAD
SMITH, MAUREEN
PEERY, BETH
PARTIS, JENNIFER
NICHOLS, DOLLIE
MONGELLI, SUSAN
BOWMAN, ROGER
BECK, SELENA
HUBBARD, RONALD
BRADFORD, HAROLD
WORDEN, JO
SALMERON, FRANKLIN
WILLIAMS, JOHN
MORRIS, MARGARITA
AUTEN, MARIA
REED, FREDERICK
ARMS, DONNA
ROWAN, LOUANN
CORDELL, YETTA
LEASURE, MYRTLE
HAGERMAN, TRACIE
BREEDEN, BEATRICE
INGRAM, FORREST
BUTLER, DERRICK
ELLIOTT, ANDREW
GREER, MARY
KAUR, ESTHER
WATKINS, ANITA
CLARK, BRIDGET
BRITT, JENNIFER
SALAZAR, RENEE
PLUMLEE, ROLAND
WINGO, BONNIE
WEBER, MARGARET
MITCHELL, TIMOTHY
COX, DOUGLAS
VANDESANDE, BONNIE
GORDON, DARIN
HESSE, MOISES
SCHWIPPS, TERRY
LEYENDECKER, SONYA
SONODA, JULIA
SMITH, ROD
BRANZ, TAMMY
LAFLAMME, KYM
MARSHALL, CHRISTOPHER
KAISER, JAMES
MORGAN, JORGE
SISSON, JAMES
VIRES, ANNE
DAVENPORT, MAX
RATLIFF, ADELA
DAVIGNON, FELICIA
DURST, PATRICIA
POKORNEY, JUAN
CASTRO, ALICE
PARKHURST, BENJAMIN
EASLEY, BONNIE
STURKIE, GRANT
ROGERS, FERNANDO
CHRISTIAN, DOROTHY
MCCRACKEN, CHARLES
PRUDEN, ANDREW
HAYMOND, KATHRYN
PEREZ, LOIS
ROSALES, ANN
CHATHAM, ELIZABETH
MORGAN, IVY
DELTON, CARRIE
MORABITO, CARLOS
WYLAM, JEFFREY
MCCORMICK, ZACHARY
TURNER, MARTHA
LEWIS, GLADYS
WEAVER, JO
KEISER, JOHN
COTE, JACQUELINE
FRANKLIN, PAMELA
TIGHE, ESTHER
MORIN, MARK
POEPPELMAN, THERESA
MATTHEW, BRYAN
HILL, CURTIS
FINNEGAN, JUSTIN
HARRISON, FLORENCE
TROUTT, DOUGLAS
LOPEZ, RICHARD
BLOOMQUIST, MATTHEW
JULIAN, RICHARD
SHECKLER, THOMAS
MILLER, VAUGHN
WAITMAN, APRIL
MOORE, LORENZO
KARPINSKI, BRANDON
MURPHY, JOHN
MCKINNEY, JAN
BRUNDAGE, MILDRED
RILEY, MARTHA
STEELE, ELMO
HARVEY, ANN
WILLIAMS, REGINALD
SMOTHERS, MARY
HALL, MARGARET
ESCOBAR, KIRSTEN
TURNER, FLORENCE
LITTLE, PATRICIA
BELMONT, GARY
LANE, ALICE
VALVERDE, IDELLA
VACHERESSE, GREGORY
MCLENDON, GARRY
SHUMATE, CATHERINE
DOMINGUEZ, MARTIN
CHILDERS, REBECCA
DWYER, JEANNIE
JOHNSON, TAMMY
SHAW, DAVID
STEEL, JOYCE
LUCEY, JAMES
CHONG, RYAN
BARNHART, PATRICIA
TAYLOR, JOHN
THOMPSON, RICKY
WALLER, BRIAN
DEBOSE, ANNIE
ITURBE, MITCHELL
HORNBECK, SIMON
FIELDS, RICHARD
RICKS, ROBERT
KIRBY, BRIAN
DONNELLY, HAROLD
MOON, WILLIAM
DERRICK, DALE
HEATH, WADE
NASWORTHY, RAMONA
CASEY, CHARLENE
JOHNSON, MARTHA
FRIEL, GENOVEVA
SIFFORD, KEITH
ROSS, MYRON
HYDE, GLENN
EVANS, GREGORY
ABRAMSON, CHRISTIE
VALENCIA, RYAN
CHAVEZ, ANGELA
DAVIS, MARIE
PERRY, JESSE
PICARD, CHERYL
LARSON, LOUIS
BELTRAN, HILDA
CHAPMAN, JENNIFER
SKEANS, MERYL
RUIZ, DOROTHY
CANGELOSI, CLEMENTINE
JEMISON, CHARLES
HILL, HASSAN
TOWNSEL, NORAH
WILSON, EDITH
SHIELDS, HOYT
HOWLIN, NATASHA
WESTMORELAND, CLARICE
GUTIERREZ, MARK
GUNDLACH, PATRICIA
WILLIAMS, ADRIENNE
MEYN, RONALD
DESMARAIS, TERRENCE
WALTERS, JUSTIN
LOPEZ, LULA
THOMPSON, WESLEY
HOLCOMB, STEPHEN
MCCLELLAN, IRMA
BANUELOS, ELLA
SUMMERS, JIM
WHITE, SHELIA
SMITH, DOUGLAS
NG, CHRISTOPHER
FARIA, ROBERT
NOLAND, CHRISTOPHER
CLANCY, GERALD
FREEMAN, JOSE
MANNING, BRIAN
LAFLEUR, BRIDGET
KELLEY, KRISTY
HADDEN, GERALDINE
GREY, MARSHA
LADNER, GEORGE
HATHAWAY, DENNIS
CANNATA, TAMMY
DIAZ, EDWARD
PATE, MICHAEL
LANE, GABRIEL
CARLTON, CLIFFORD
GREGORY, MICHAEL
NELSON, DONALD
MILIAN, MARY
JEWELS, ARMANDO
LANDRETH, TYRONE
BALDERAS, BRUCE
DICKMAN, CATHERINE
GUTIEREZ, ROSE
LAMPHERE, LARRY
KNIGHT, CHARLES
TRIAS, THERESA
HODGE, LAUREN
SHIPPY, ISRAEL
FOSTER, TED
EUNICE, JOHNNIE
MOUNTS, ESTHER
HALL, DEBRA
SOTO, PATRICIA
STONE, JAMES
BENEAR, LINDSEY
SMITH, RAUL
VANTASSEL, SAMUEL
PEREIDA, CARL
ALLEN, DONNELL
TICE, JASON
SANTIAGO, JOHN
MOORE, VERONICA
BRYANT, FREDERICK
MARROQUIN, CHRISTOPHER
STETLER, JAMES
STANCLIFF, RUBY
RAY, PATRICIA
GARCIA, MANUEL
LEUTHOLD, CATHI
HALLORAN, AVIS
DEMAIO, ROBERT
LAMB, CLARE
JARAMILLO, EMILY
EGGENBERG, RONALD
ALLRED, JASON
ISLAS, GUADALUPE
MILBURN, GEORGE
HANSING, CHRISTOPHER
CASILLAS, BLAKE
CONTI, JEROME
BISHOP, MARCELINO
COOPER, HOUSTON
TIFFANY, JAMES
RUMINSKI, AMY
JOHNSON, TAMEKA
PADILLA, FLORENCE
PETER, RODNEY
CASSIDY, BETTY
CRADER, BENNETT
SHRADER, ROSE
MCKINNEY, DANIEL
CARRASCO, MARY
FORD, SCOTT
YANCY, ELLA
WHITE, SANDRA
DYER, CHARLES
TOADVINE, CARL
SLOAN, LILLIAN
DUFFY, MARGARET
PENN, KEITH
SCHMITT, AMY
PETIX, WILLIAM
DONALDSON, JEFFREY
ANDERSON, LINDA
HIDES, MICAH
MCKINNEY, SYLVIA
TINSLEY, AMANDA
KIMBERLIN, CHRISTOPHER
SMITH, RICHARD
MICHAELS, LAVONNE
THOMPSON, MELISA
SKIDMORE, ALLEN
MCLAUGHLIN, JOSE
JONES, IOLA
BURKE, PATRICIA
ODOUGHERTY, LUIS
MARQUEZ, JOSEPHINE
FOSTER, GRACE
STEWARD, ALEXANDER
MELITO, STEPHANIE
WALKER, FLOSSIE
LOWRY, WALDO
GRADY, JASON
SHANE, MELVIN
PESSO, MICHAEL
MENDONCA, RENA
JONES, MICHAEL
HOLDER, ANDREW
HILL, LLOYD
ADAMS, COLUMBUS
DODSON, MARGARET
SAVAGE, ELIZABETH
PARK, ELEANOR
RUBIO, RONALD
HILTON, ISMAEL
TOLBERT, TONY
MELLON, PAMELA
SCHNEIDER, DONNA
BROWN, PAUL
NORTHROP, EDWIN
REILLY, ALEX
DOLAN, AMADA
LEWIS, LINDA
SLAYMAN, JARED
BOMAR, GEORGE
GARCIA, ROSARIO
CURTIS, ELAINE
WILLIAMS, CINDY
LYVERS, LINDA
YOCHUM, BILLY
SCHNEIDER, EMMA
NUGENT, KENYETTA
DAVIS, JAMES
GASPER, GREGORY
TONY, BRENT
BARBOSA, NEAL
KOCHANSKI, CAROL
HONEYCUTT, DANIEL
BAKER, KIMBERLY
CHANG, PATRICIA
BURGIN, SHARRON
PARENTI, JIMMY
PEOPLES, MARINA
DOVER, ALISA
CALVERY, TONI
TITUS, PATRICIA
JOHNSON, GWEN
ADAMS, IVA
HARRIS, DELORES
GARCIA, RICHARD
HOWARD, CHARLES
CRASS, DARYL
VANESS, THOMAS
LE, WILLIAM
VILLA, JAMES
NATHAN, DOROTHY
LEWIS, BRADLEY
PATTON, ROBERT
GREENFIELD, WILLIAM
ANDERSON, JAMES
RAGER, CANDANCE
BRADSHAW, KENNETH
DAILEY, ERVIN
SAHOTA, CONSTANCE
DEJESUS, MARY
BARNES, CONNIE
SHULL, VINCENT
CARLAN, REBECCA
MCCRACKEN, MARIA
MITCHELL, SARAH
KOMER, MARGARET
BURDICK, PAM
LANGFORD, DOMINIQUE
MUSSON, TARA
ROBINSON, MISTY
BALDWIN, LEWIS
STEWART, BOYD
REED, BETHANY
HILLMAN, JERRY
ALEXADER, ROBIN
PRESTON, ANGELA
JOHNSON, JENNIFER
BOYD, HARRY
CAMPBELL, ARTHUR
THOMPSON, KEVIN
SMITH, SHARON
SCHULER, BOBBY
HIGGINS, KATHLEEN
MCDONALD, BENJAMIN
SPENCER, GWENDOLYN
GREEN, SHARON
ANDREWS, JOEL
VAUTERS, DONNA
DETRICK, CATHERINE
VANDOREN, RON
FRAY, KAY
SOSA, ERIC
HERTENSTEIN, CHRISTOPHER
SCOTT, GERARD
COMPTON, KARA
HEICHEL, JAN
SALTER, CLAYTON
GOAD, TRAVIS
PARAMO, MARTHA
SHIPP, LORETTA
ROBSON, LEONARD
OLEARY, PRINCESS
SPRINKLE, JAMES
GARCIA, RAMON
HALL, JOSEPH
WARNER, LOIS
BARBEAU, THOMAS
HANEY, TIESHA
COMNICK, GENEVA
ACKERMAN, JONATHAN
BROOKS, JODY
BOOTH, CYNTHIA
PAZ, LANA
STEVENSON, BLANCA
STEVENS, ERMA
WALTERS, JANIE
HITE, CELIA
KNOPP, LAWRENCE
HESTERMAN, ERIC
TATE, MARY
PAIK, DAVID
PELLERIN, KATHERINE
BONNETT, KAREN
DOMINGUEZ, LATOYA
COMPTON, DOUGLAS
ISOM, SIDNEY
GRIFFIN, FELICIA
KILKENNY, JERRY
MOBERLY, EMILY
LANGLINAIS, JAMES
BEANBLOSSOM, CLEMENTINE
STEWART, CHI
MARKS, TAMMARA
KLEIN, SARAH
PEREZ, JOHN
DOYLE, BRIAN
CRAWFORD, MARY
CARRIAGA, WANDA
BOGGIONI, LOUIS
RAMOS, GRETCHEN
FLORES, VINCENT
HAMMOND, TAMEKA
CONRAD, ROBERT
REED, CHRISTINE
CUOMO, PATRICE
WRIGHT, VIVIAN
ROBERTSON, SANTOS
SANDFORD, PATRICIA
WEED, EDGAR
MCCLURE, NONA
COUTURE, PAMELA
STEIN, DAVID
LARSON, WAYNE
REED, ADRIANA
HUGLE, RAMON
BREAU, JUDITH
TIGNOR, WALTER
BERG, LYNDA
RICHARDS, BOBBY
XAYASITH, TONY
MARLOWE, MATTHEW
POTEET, REBECCA
AGUINIGA, MELLISA
LOCOCO, ANTONIO
NANCE, GEORGE
STENN, FREDERIC
BARNES, LYNN
FULTON, MARY
ROBERTSON, NICHOLE
BROTHERS, CHRISTINE
KEYS, ERMA
DEPERTE, APRIL
DRAKE, BROCK
CLARK, MARIA
STERNER, ROBERT
POPE, HAROLD
WERTZ, JAMES
STEAKLEY, DENISE
LARRIEU, ZACHARY
GOULD, JOHN
MILLER, ELISE
BELL, MARILYN
ZHOU, GAIL
MOSBY, IAN
BUZBEE, THOMAS
BROWNE, SUE
TERRY, KENNETH
REMPEL, SHEILA
GLENN, JAMES
VADASY, CHERYL
KLOECK, MARK
FRISCH, VIRGINIA
HASBERRY, WILSON
MOORE, JAN
BLY, WILLIAM
STARR, PAMELA
NEU, MARY
CALLEJA, JANET
MCCRACKEN, ANTONIO
HARDISON, ROBERTA
VIOLETTE, GEORGE
BROWN, JAMES
CARTER, EDGAR
JENSEN, ELMIRA
BOUDREAUX, MICHAEL
YOUNG, DANIEL
CRITCHFIELD, GREG
MARTINEK, MICHAEL
BELANGER, PAUL
YOUNG, CLARA
KEENER, DAVID
BOYD, ANDREW
DORAZIO, DIANA
ELUMBAUGH, JENNIFER
NEWTON, JAMES
HARRI

Haven't looked at it in details, but I see that your search function is a linear
search. Make it a binary search since the array should be sorted already. You will see that
using the linear search you will have to do about on average N/2, where N is the total names,
while in binary search you do about log2(N). In low numbers for N it does not make big
difference, but if N was say 1 million, by using linear search you will have to make in average
500,000 comparisons, while in binary search you will make log2(1000000) which equals about 19 comparisons.

Edited 6 Years Ago by firstPerson: n/a

I have pondered the binary search several times, but I was told to use linear for the time being....

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