assignment help

Hi, I am supposed to read two files, and create a new file combining previous two file, i was able to open a new file but the data isnot being transferred there.how do I fix it.

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

int main() {
ifstream infile;
infile.open("StudentData.tsv");
string id, semcod, subcod, catcod, letgrad, numgrad;


ofstream tfile;
tfile.open("StudentDataPlus.tsv");

while (!infile.eof())
{
infile >> id >> semcod >> subcod >> letgrad >> numgrad ;



ifstream myfile;
myfile.open("HunterCourses.tsv");
string sub, catnum, hrs, dcode;
while (!myfile.eof())
{
myfile >> sub >> catnum >> hrs >> dcode ;


if((catcod==catnum) && (subcod==sub))
{
tfile << id << semcod << subcod << catcod << letgrad << numgrad << hrs <<dcode;
}

}
myfile.close();

}
tfile.close();
infile.close();

}




First, please use the code tags. See http://www.cplusplus.com/articles/jEywvCM9/

What is the value of catcod? I don't see it set anywhere.
Topic archived. No new replies allowed.