the while loop is not reading the dates of each line. mm/dd/yyyy
everything in the file is reading accept the begining of each line which starts with the date. How do i fix it to make the program read the whole file.
Expand|Select|Wrap|Line Numbers
- #include <iostream>
- #include <iomanip>
- #include <string>
- #include <fstream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int month;
- int day;
- int year;
- int junkChar;
- string sampleInput;
- ifstream inFile;
- inFile.open("F:\\data3.txt");
- while(!inFile.eof())
- {
- inFile>> sampleInput;
- getline(inFile,sampleInput,'\n');
- if ( sampleInput=="")
- {
- cout << endl;
- }
- else
- cout << sampleInput << endl;
- }
- cout << endl;
- inFile.close();
- return 0;
- }