I am having some problems reading from a file. I have two header files: a and b. b is derived from a,and c is derived from b. Now i want to open a text file.
The whole format is like this:
A john
A johnee
P 123
If the first charcter is 'a' and 'p' is also there, then print the second line, else print the first line.
#include "c.h"
#include <iostream>
# include <fstream>
using namespace std;
c :: c()
{
ifstream input;
input.open ("abc.txt");
ch = input.get();
input >> ch;
if (ch ='A')
a* z =new a();
else
input.close();
}
Can anyone give me some advice on how to accomplish this?