Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations SSS148 on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

data files in C++

Status
Not open for further replies.

19780408

Civil/Environmental
Oct 29, 2006
1
Hi friends,
I am new to C++ programming. So please help me for my problems.

I have two data files. Both have ID with some different data.
My program should read a ID in first file then it should read second file corresponding to that ID and print it out.
I tried in following way but it didnt work. Pls help me to improve my program.

while(getline(input1, buff)) {
istringstream tmp(buff);

int a, b;
tmp >> a >> b;
while(getline(input2, buff)) {
istringstream tmp(buff);

int x, y, z;
tmp >> x >> y >> z;
if (a==x) {
output << x << " " << y << " " << z << endl;
cout << x << " " << y << " " << z << endl;
}
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor