0

Hello all,

First time user on this web forum, I'm having problems with this function I'm building

So I need to read in all the data for one movie from a text file that contains several movies

text file looks like this

7 8.9 1993 281646 D 195 Schindler's List
8 8.9 1957 122408 D 96 12 Angry Men
9 8.8 1975 219012 D 133 One Flew Over the Cuckoo's Nest
10 8.8 2008 474562 A 152 The Dark Knight

the function belongs to a class named MovieType

when i call the function in main, and i try to cout the first variable " rank" its giving me garbage..... any ideas?

bool MovieType::readMovieInfo(ifstream &movie)
{
	bool endFile = false;

	movie.open("movie.txt");
	movie.ignore();
	movie >> rank;
	movie >> weight;
	movie >> year;
	movie >> votes;
	movie >> genre;
	movie >> length;
	getline(movie, name);

	if(endFile = true)
		return endFile;
}

//

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by theUserMan
0

Adding to this

I'm going to have to sort each movie into the correct Movie Genre, I'll be adding the movie into the correct genre que.

I already have the que built and working properly...

I'm just wondering how I'm going to be able to put all the data of one movie onto the que, since I thought a que can only hold one variable... any ideas on how to implement this?

I'll be deQueing one movie at a time onto a text file.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.