Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   Issues with Arrays (http://www.go4expert.com/forums/issues-with-arrays-t23770/)

golf_girl32 4Nov2010 21:16

Issues with Arrays
 
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 7Nov2010 04:41

Re: Issues with Arrays
 
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 (Post 74395)
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);
    {
       
    }




All times are GMT +5.5. The time now is 05:32.