file reading

filename.get(char variable); Not Working.
Here's the code and file in my periodic table project.
The second loop isn't working eventhough I 'seekg'ed it to zero.
Neither is my sourcefile.getline() working.
First I thought that this is because I reached the end of file in the first loop. So I seekged it. But it is of no use >:
here's the file.

I suspect the stream is in the fail state after the first and second loop, because the terminating condition of each of the loops is that the stream isn't able to read anything into ch using get() anymore. I'd try putting a call to clear(), eg. sourcefile.clear();, to clear the fail bit after each of the first two loops. You might even have to reopen or reassociate the stream/file, too, but I don't think so.

"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens