Simple Address Book...

My professor keeps telling us its all about listing things and telling the computer how to do tasks one at a time in the order we want them done, (but he doesn't really tell us how to do that) so I've done that here with a few void statements to open a file, read it, then print a number to go along with a name that the user types in....it's obviously missing a few things but I'm not sure what or even where to go from here...any help would be appreciated.


#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;

//open file
void open_file(ifstream);
//read names
void read_names(string);
//user input name
void user_input(string, string);
//output number
void output_number(string);


int main()
{
ifstream infile;
string fname, lname, name;
read_names(name);
user_input(fname, lname);
output_number(name);
system("pause");
return 0;
}

void open_file(ifstream)
{
ifstream infile;
infile.open("phone.txt");
}

void read_names(string)
{
ifstream infile;
open_file(infile);
string name;
getline(infile, name);
}

void user_input(string, string)
{
string fname, lname;
cout<<"Type first name followed by the last name (seperated with a space)"<<endl<<endl;
cin>>fname>>lname;
}

void output_number(string)
{
string fname, lname, name;
read_names(name);
user_input(fname, lname);
fname=name;
cout<<name;
}
This is the address book....

Sean Collins 5556497239
Robert Howell 5552221737
Stephen Pietsch 5558699837
Erica Trembley 5558472738
Eileen Dover 5556457384
Benjamin Dover 5555768493
Topic archived. No new replies allowed.