This is my program wondering why it shows a blank data at the end
any clues?
Code:
#include <iostream.h>
#include <fstream.h>
int main()
{
char BookTitle[20];
char Author[15];
char Cost[10];
char Pages[11];
ifstream FileIn("authors.txt");
while(FileIn)
{
FileIn.get(BookTitle, 20, ',');
FileIn.get();
FileIn.get(Author, 15, ',');
FileIn.get();
FileIn.get(Cost, 10, ',');
FileIn.get();
FileIn.get(Pages, 11, ',');
cout <<"Book Title: "<< BookTitle << endl;
cout <<"\n" <<"Author: "<< Author << endl;
cout <<"\n" <<"Cost: " << Cost << endl;
cout <<"\n" <<"# of Pages: "<< Pages << endl;
cout <<"*******************************************"<< endl;
}
return 0;
and my output looks like this why does it print out when there is no more info?
Book Title: Gone With The Wind
Author: M. Mead
Cost: $19.00
# of Pages: 384 pages
*******************************************
Book Title:
Bones To Dust
Author: H. Hoffman
Cost: $21.00
# of Pages: 174 pages
*******************************************
Book Title:
Get This File
Author: M. Mcardle
Cost: $29.99
# of Pages: 234 pages
*******************************************
Book Title: //why is this here???????
Author:
Cost:
# of Pages:
*******************************************
Press any key to continue