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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
while(!infile.eof())
{
infile.ignore(256, ';');
infile.ignore(256, ';');
infile.ignore(256, ';');
infile.ignore(256, ';');
infile.ignore(256, ';');
infile >> tempWeight;
if ((tempWeight >= 1000) && (tempWeight <= 2000))
{
w1++;
}
else if ((tempWeight >= 2000) && (tempWeight <= 3000))
{
w2++;
}
else if ((tempWeight >= 3000) && (tempWeight <= 4000))
{
w3++;
}
else if (tempWeight > 4000)
{
w4++;
}
infile.ignore(256, ';');
infile.ignore(256, ';');
infile.get(tempOrigin, MAXCHAR, ';');
if (strcmp(tempOrigin, "US")==0)
{
origin = US;
}
else if (strcmp(tempOrigin, "Europe")==0)
{
origin = EU;
}
else if (strcmp(tempOrigin, "Japan") == 0)
{
origin = JAP;
}
else
{
origin = ILLEGAL;
}
infile.ignore('\n');
writeOrigin(origin, tempOrigin);
cout << tempOrigin << endl;
}
cout << "Cars with w1: " << w1 << endl;
cout << "Cars with w1: " << w2 << endl;
cout << "Cars with w1: " << w3 << endl;
cout << us << ' ' << eu << ' ' << ' ' << jap;
}
|