I/O files program

I am given two files to work with. One lists popular baby names that are ranked by their popularity, the other is a list of all the names in my class. I have to use a function that will send an output stream and a name to be found which will then open the input file, search the file for the name to discover its ranking and then write the information on to the output file. The program is intended to rank each name in my class using the "babynames.txt" file with all the name rankings and then average the ranking for students names in our class. So far all i have is this...

#include <iostream>
#include <fstream>
using namespace std;

void nameranking();

ifstream inputfile;
ofstream outputfile;

inputfile.open("babynames2012.txt");


int main()
{

Well that's a good start congrats !

It seems to me you need to start fresh.
write down the steps on paper, use notepad if you wish.
for example above you say you need to open 2 files but you only define 1 input and one output in your code.
making a list of things to do and in what order will make your programming project go much easier.
Last edited on
Topic archived. No new replies allowed.