.
.
.
void readFile()
{
ifstream input("list.txt");
if(input.fail())
{
cout << "\n Files does not exist."
<< "\n Program Exit.";
return;
}
string data, ic, name, cNum, email; //read data
int c = 0; //count data
while(!input.eof()) //continue if not end of the file
{
getline(input, data, '\n');
c++;
switch(c)
{
case 1:
id = data;
data = "";
break;
case 2:
name = data;
data = "";
break;
case 3:
cNum = data;
data = "";
break;
case 4:
email = data;
data = "";
c = 0;
break;
default:
cout << "\n Count error";
}
addData(id, name, cNum, email); //add data to the link list
}
cout << "\n All applicants data added successful.";
}
.
.
.
here's my "list.txt" file
111111111111
name name
1111111111
email@email
2222222222
name name
1212121212
email@email
939393939393
name name
2323232323
email@email
my problems here there are 4 copies of data added to my link list, it mean there are 4 same data added to my link list... i can't find what is the problem... can someone help me please...