Issues with Arrays

golf_girl32's Avatar
Go4Expert Member
I am mostly finished with my program. All I need to do is at the end enter 5 movie titles and have them print out "Movie Title 1: " etc for all 5. I'm stuck on how to do that at the end.

Code:
#include <iostream>
 using namespace std;
 //Structure for each video information
struct Video
{
  string movieTitle;
    int numberCopies;
    string videoType;
};
 struct re_order_Date
{
 int month;
    int day;
    int year;
};
 void get_Video(Video shows[], int number_of_shows);
 int main()
{
 Video videoInfo;
    videoInfo.movieTitle = "Fight Club";
    videoInfo.numberCopies = 15;
    videoInfo.videoType = "Mystery";
 cout<<"The Title of the movie is: "<<videoInfo.movieTitle<<endl;
    cout<<"The number of copies are: "<<videoInfo.numberCopies<<endl;
    cout<<"The type of video is: "<<videoInfo.videoType<<endl;
 Video videoinfo2;
    re_order_Date reOrderDate;
    videoinfo2.movieTitle = "Requiem for a dream";
    videoinfo2.numberCopies = 10;
    videoinfo2.videoType = "Drama";
    reOrderDate.month = 05;
    reOrderDate.day = 17;
    reOrderDate.year = 2011;
 cout<<"The Title of the movie is: "<<videoinfo2.movieTitle<<endl;
    cout<<"The number of copies are: "<<videoinfo2.numberCopies<<endl;
    cout<<"The type of video is: "<<videoinfo2.videoType<<endl;
cout<<"The re-order date of the movie is: "<<reOrderDate.month <<reOrderDate.day <<reOrderDate.year <<endl;
 Video allVideos[5];
 void getVideo (Video shows[],int number_of_shows);
    {
        
    }
ihatec's Avatar, Join Date: Sep 2010
Go4Expert Member
Did you try to use loops?
For arrays the best idea is to use for loop(because you know the size of it) for entering and printing your data.

Quote:
Originally Posted by golf_girl32 View Post
I am mostly finished with my program. All I need to do is at the end enter 5 movie titles and have them print out "Movie Title 1: " etc for all 5. I'm stuck on how to do that at the end.

Code:
#include <iostream>
 using namespace std;
 //Structure for each video information
struct Video
{
  string movieTitle;
    int numberCopies;
    string videoType;
};
 struct re_order_Date
{
 int month;
    int day;
    int year;
};
 void get_Video(Video shows[], int number_of_shows);
 int main()
{
 Video videoInfo;
    videoInfo.movieTitle = "Fight Club";
    videoInfo.numberCopies = 15;
    videoInfo.videoType = "Mystery";
 cout<<"The Title of the movie is: "<<videoInfo.movieTitle<<endl;
    cout<<"The number of copies are: "<<videoInfo.numberCopies<<endl;
    cout<<"The type of video is: "<<videoInfo.videoType<<endl;
 Video videoinfo2;
    re_order_Date reOrderDate;
    videoinfo2.movieTitle = "Requiem for a dream";
    videoinfo2.numberCopies = 10;
    videoinfo2.videoType = "Drama";
    reOrderDate.month = 05;
    reOrderDate.day = 17;
    reOrderDate.year = 2011;
 cout<<"The Title of the movie is: "<<videoinfo2.movieTitle<<endl;
    cout<<"The number of copies are: "<<videoinfo2.numberCopies<<endl;
    cout<<"The type of video is: "<<videoinfo2.videoType<<endl;
cout<<"The re-order date of the movie is: "<<reOrderDate.month <<reOrderDate.day <<reOrderDate.year <<endl;
 Video allVideos[5];
 void getVideo (Video shows[],int number_of_shows);
    {
        
    }
shabbir like this