he read only recordnumber 1 from file test.txt
please help me
attachement below
Code:#include <iostream> #include <string> #include <cassert> #include <fstream> using namespace std; char c; string line; int Numb; int lineNumber; char Data [10]; const int FileNameLen = 30, ArrayLen = 6; int main() { ofstream outfile; char filename[FileNameLen]; cout << "Enter file name\n"; cin >> filename; ifstream inFile(filename); if (filename != "") // if filename is difrent then nothing, file exist { cout << "File is Open\n"; } cout << "Enter a Recordnumber): "; cin >> Numb; int lineNumber = Numb; //ERROR: LineNumber is RecordNumber but he takes, // Only recordnumber 1 data and 2 doesn't work from file test.txt if (Numb <= 0) { cout << "No Such Recordnumber,Program Will Shut Down\n)"; return 0; } else { inFile >> line; if(inFile.eof()) { inFile.close(); cout << "End of File): "; return 0; } inFile.seekg(lineNumber, ios::beg); getline(inFile, line); } cout << "Line Number Information: " << line << "\n"; //cout << "The read position is at: " << lineNumber << endl; inFile.close(); cout << "END OF THIS TEST PROGRAM WRITED BY CYBERBJORN AND MODJO\n"; return 0; }