I have a hard time to create it... and I have the problem with how do u search the people...
does anyone know how to create it?
thank u

Write a program that reads in a first and last name from the user, then looks up a record from a file for that name.
Input format
The input file has one line for each record it stores. Each record contains:

last name (a single word)
first name (a single word)
gender (male or female)
salary (an integer)
A sample file might look like:

Adu Freddy male 550000
Baker James male 0
Friedman Stephen male 157000
McGraw Phil male 45000000
Phillips Julia female 30000
Rove Karl male 157000
Spellings Margaret female 157000


Output
The program reads in a first and last name from the user and then searches through the file to see if it can find the name. If it is found, just output the line from the file. If not, indicate that the person was not found. Note that even if you know the person is not the one you are looking for, you still have to read past the rest of the line.

Here is a sample run

This program helps you look up the salary of a person.
Salaries are stored in salary.txt


Enter the first and last name to search, last name first, space separating the names: McGraw Phil

McGraw Phil male 45000000
Press any key to continue

Here is what I have so far
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main()
{
string lastname;
string firstname;
string gender;
int salary;
ifstream infile;
string name;
char ch;


infile.open("salary.txt");

infile>>lastname>>firstname>>gender>>salary;

cin>>name;

while (infile)

{

cout << lastname << endl;
infile.get(ch);

if (name== lastname)

cout<<"my name is"<<lastname<<" "<<firstname<<gender<<salary<<endl;


else
cout<<" person was not found"<<endl;

}

return 0;
}