Okay, so I have a program that lets a user input information about dvds...it's a dvd library basically. I'm having a bit of trouble with nice output.
I have data members for part of the info and vectors for the others. The output should show a movie title,length, year, actor/actresses, and characters.
It does this when there is only one dvd... when there are two or more, it tries to add the second movie title to the last line of the previous characters/actors.
Here is my code so far:
void list(vector<DVD> &vectorName, vector<string>&vectorCharName, DVD *mydvd)
{
//table format
cout << setw(10) << "\nMovie Title: "
<< setw(10) << "Length:"
<< setw(10) << "Year: "
<< setw(10) << "Actors/Actresses:"
<< setw(10) << "Characters:\n" << endl;
cout << "------------------------------------------------------------\n";
for (int i = 0; i < vectorName.size(); i++)
{
if(i <1)
{
if(mydvd[i].getLength()!=0)
{
cout <<endl<<setw(10)<< right << mydvd[i].getTitle()
<<setw(10) << mydvd[i].getLength()
<< setw(10) << mydvd[i].getYear();
}
else
{
cout <<setw(10)<< right << mydvd[i].getTitle();
}
}
else
{
if(mydvd[i].getLength()!=0)
{
cout <<endl<<setw(10)<< right << mydvd[i].getTitle()
<<setw(10) << mydvd[i].getLength()
<< setw(10) << mydvd[i].getYear();
}
else
{
cout <<setw(10)<< right << mydvd[i].getTitle();
}
}
if(i <1)
cout<<"\t\t"<<vectorName[i].getName()
<< " "<<vectorCharName[i] << endl;
else
{
cout<<"\t\t\t\t"<<vectorName[i].getName()
<< " "<<vectorCharName[i] << endl;
}
}
}