Hi! Is it possible to read from specific row on a notepad?
For Example:

Jay
Mark
Christian

I only want to display the word Christian which is on the third row, what will I do? can you please show me? Thanks! Here's my code:

#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <cstring.h>
#include <string.h>
#include <conio.h>

//using namespace std;

int main()
	{

      char account[80];

	   char string1[] = ".txt";

     	char string2[17];

      cout<<endl;
      cout<<"Enter Account Number: ";
      cin>>account;

      strcpy(string2, account);

     	strcat(string2, string1);


    			int bal = 0;
    			int x;
    			ifstream inFile;

    			inFile.open(string2);
    			if (!inFile) {
        		cout << "Invalid Account";
        		exit(1); // terminate with error

       }
    			while (inFile >> x)
            {
        			bal = bal + x;
            }

    			inFile.close();
    			clrscr();
            cout<<endl;
    			cout<< bal << endl;
    			getch ();
    			return 0;
}

Read three lines in a row. The last read is the one you want.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.