in response to an inclass exercise where the following question was possed: write a program using structures, which will capture a list of 10 movies, the data members should be title and year.
the problem is the program is not capturing all the details and is printing unintelligible information. what might be wrong with my code am using Visual Basic C++ 6.0. IDE

#include "stdAfx.h"
#include <iostream>
#include <sstream>
#include <string>
using namespace std;

struct movies_2015{string title; int year;}your_movies[10];

void create_title_year(movies_2015 movies[]);

void print_movie(movies_2015 mov[]);

int main()
return 0;

void create_title_year(movies_2015 movies[])
        string mystr;
    for(int i=0;i<10;i++){
        cout<<"Enter Movie Title: ";
        cout<<"Enter Year: ";

void print_movie(movies_2015 mov[])
        cout<<"Movie Title\tYear"<<endl;
    for(int i=0;i<10;i++){
        cout<<mov[i].title<<" ( "<<mov[i].year<<" ) "<<endl;

Your code seems to work fine for me when I compiled it with MinGW after I commented out #include "stdAfx.h".

Note that "Visual Basic C++ 6.0" is not a thing did you mean Visual C++ 6 which is rather old?

meant visual c++ 6.0 thanks for the correction. Do you suppose its the problem is with the compiler most of my code runs but when i get to use the getline function repeatedly i get output related problems. i think i should upgrade or migrate to some other compiler. Once again thank you !

I supose it may be the compiler and it certainly wont hurt to use a more up to date one but from my recollection I would have thought the Visual C++ 6 compiler should be capable of handling this code.

This question has already been answered. Start a new discussion instead.