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
|
void viewAllInventory()
{
system("cls");
cout << "\n\n\nAll Vehicle Information: \n\n\n";
cout << " - Year - Make - Model - Color - Mileage - Price - \n\n";
ifstream inCar;
inCar.open ("E:\\CarLib.txt");
if (inCar.fail())
{
cout << "Unable to find Vehicle Listing.\n";
system("pause");
}
else
{
string line,year,make,model,color,mileage,price;
while (!inCar.eof())
{
getline(inCar,line);
istringstream lines(line);
getline(lines, year, ' ');
getline(lines, make, ' ');
getline(lines, model, ' ');
getline(lines, color, ' ');
getline(lines, mileage, ' ');
getline(lines, price, ' ');
cout << " - " << year << " - " << make << " - " << model << " - " << color << " - " << mileage << " - " << price << " - " << endl;
}
}
inCar.close();
cout << "\n\n";
system("pause");
}
|