Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone tell me why I am getting a infinite loop when this runs? I am trying to read in from a text file. void

Can someone tell me why I am getting a infinite loop when this runs?

I am trying to read in from a text file.

void readInventory(vector &list)

{

int i = 0;

string temp;

ifstream iFile("cars.txt");

iFile.open("cars.txt");

if (iFile.is_open());

{

while (!iFile.eof())

{

{

for (i = 0; i <= 100; i++)

{

iFile >> temp;

cout << "VIN:";

cout << temp << endl;

iFile >> temp;

cout << "Make:";

cout << temp << endl;

iFile >> temp;

cout << "Model:";

cout << temp << endl;

iFile >> temp;

cout << "Year:";

cout << temp << endl;

iFile >> temp;

cout << "Price:";

cout << temp << endl;

iFile >> temp;

}

}

}

}

iFile.close();

cout << endl;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago