dont know exactly what i was doing wrong as i havent taken time to compare the code that i was give but here is what works
// file: main.cpp
// author: Kyle Kjorsvik
// date: 8/31/04
// class: CSIS 352
// This is the file that contains the main function for assignment 1.
#include <iostream>
#include <fstream>
#include <string>
#include "date.h"
//#include "inout.h"
//#include "agecalc.h"
//#include "data.h"
using namespace std;
struct birthdate{
string name;
string bdate;
};
int main() {
const int maxvalue = 10;
birthdate bd[maxvalue + 1];
int i = 0, j;
ifstream inFile("data");
if (inFile.fail()) {
cerr << "An error occurred. Unable to read input file." << endl;
exit(1);
}
cout << "File opened" << endl;
while(!inFile.eof() && i < maxvalue) {
getline(inFile, bd[i].name, ',');
getline(inFile, bd[i].bdate);
++i;
}
inFile.close();
for (j=i-1; j>=0; j--){//print backwards for giggles
cout << "\t" << bd[j].name << "\t" << bd[j].bdate << endl;
}
return 0;
}