Hello, it's been a while since I took my last programming class, and I must say I don't know how to do the following. I want to create a program that pulls data from a txt file and then lists that data. The data is simply C++ variable names, reserved words etc.The program should be able to pull any information from that text file. Just like this one:

class A {
int a[11],x,y,z;
char *oneString;
public:
A() { oneString= new char[100]; }
A() { delete oneString; }
void f();
};
void A::f() {
int temp;
x=y+1;
z=x+2; z= x*x;
}

It pulls the data and displays it.

Int
char
class


etc.

The input is just a regular text file where each line is terminated with an end-of-line character. I honestly have no idea how to do this. I thought about using arrays to get the info and display it. But would that array automatically process the info contained in the text file, since it's not just a list but classes that are being used in the input file?

Recommended Answers

All 2 Replies

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.