hello. i'm having trouble with finding a specific number in text file.
my problem is:
create a text file that contain numbers in 3 lines. each lines consist of 5 numbers.
create a program that finds the first number in the first column
and load the rest of the 5 numbers in the program.
#include<iostream>
usingnamespace std;
#include<fstream>
int main()
{
int inInfile_id_no, inId_no;
int inVar1, inVar2, inVar3;
string names;
while(1)
{
fstream file("ITEM_DB.txt");
cout<<endl<<"enter the id no to be searched: ";
cin>>inId_no;
do
{
file>>inInfile_id_no>>names>>inVar1>>inVar2>>inVar3;
}while(inId_no!=inInfile_id_no);
cout<<endl<<inInfile_id_no<<" "<<names<<" "<<inVar1<<" "<<inVar2<<" "<<inVar3;
file.close();
}
return 0;
}
}