Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am currently working on a piece of code that will read in from a text file line by line. However, whenever I run the

I am currently working on a piece of code that will read in from a text file line by line. However, whenever I run the code it always causes the function to be stuck in an infinite loop.

Is there something I am doing incorrectly? I can't find the issue. I am using:

#include

#include

#include

and this is the function I am having issues with.

void displaySeats(){ ifstream file("example.txt"); string str; while(getline(file, str){ cout << str; cout << endl; } file.close(); }

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

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

=+8.8. Suppose that S = (0,1,2 ,... ], Poo =1, and f,o>0 for all i.

Answered: 1 week ago

Question

2. What are the different types of networks?

Answered: 1 week ago