im reading a number of detals into a linked list and I want to stop at a certain point, the file list constains the following details: ID name surname and town, after these are all through there is then accoutn numbers : number balance, it is a bank account list, heres my code. I want it to stop when the bank accoutn numbers begin as I plan to place them into a different linked list.
#include "list.h"
#include "customer.h"
#include <iostream> // cout
#include <fstream>
#define FN "file.txt" // hardwired file name
#pragma once
using namespace std;
customerlist customerlist;
int main () {
int data ;
ifstream in;
in.open(FN);
if (in.fail()) {
cout << "unable to open " << FN << endl;
getchar(); // type key to dismiss window
return 0;
}
while (!in.eof()) {
customer *ustomer = new customer();
in >> ustomer->ID >> ustomer->name >> ustomer->lastname >> ustomer->town;
cout << ustomer->ID<< " " << ustomer->name << " " << ustomer->lastname<< " " << ustomer->town << endl ;
customerlist.add(ustomer);
}
in.close();
return 0;
}
sample of input data:
80013484 ADAMS Aiden Clonakilty
80034596 ADAMS Anna-Marie Athlone
accoutn info:
90009074 80007964 11640
90000034 80007964 -6458