1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
ifstream infile;
string classType,rubbish;
string x,y,z;
while(getline(infile,classType,','))
{
if (classType == "classA")
{
// do specific format input stream and stoi conversion
getline(infile,rubbish,'(');
getline(infile,x,',');
getline(infile,rubbish,' ');
getline(infile,y,')');
ClassA aObj(stoi(x),stoi(y));
}
else if (classType == "classB")
{
// do specific format input stream and stoi conversion
getline(infile,rubbish,'(');
getline(infile,x,',');
getline(infile,rubbish,' ');
getline(infile,y,',');
getline(infile,rubbish,' ');
getline(infile,z,')');
}
else if (classType == "classC")
{
// do specific format input stream and stoi conversion
}
}
| |