Alright, I'm progressing slowly. My output is not quite what I thought it was going to be. I was looking to justify right the title and on the same line right justify the equivalent movie number.
"Oceans 13" movie1
"Oceans 12" movie2
and so on.......How do you do this, I must need to create a tab inline or something. This isn't required, nor have I ever seen it done, actually the setw() was something I saw in some code here. Do I need to move the output all on one cout like this if I want the output to appear as it does above?
cout << setw(4) << "Oceans 13" << setw(12) << movie1 << endl;
Would I need to rewrite it all something like this to create this or is there some other way to tab 'movie1' on to the same line. I might be getting a little out of my league since this is really my first sort of real program. I don't know, getting tired though.
Is there any short cut commands to make this occur? Thanks
As you can see I had to change it ALL, I didn't like the way it looked, at all.
If there's anyway I'd appreciate it.
Joe
"Oceans 13" movie1
"Oceans 12" movie2
and so on.......How do you do this, I must need to create a tab inline or something. This isn't required, nor have I ever seen it done, actually the setw() was something I saw in some code here. Do I need to move the output all on one cout like this if I want the output to appear as it does above?
cout << setw(4) << "Oceans 13" << setw(12) << movie1 << endl;
Would I need to rewrite it all something like this to create this or is there some other way to tab 'movie1' on to the same line. I might be getting a little out of my league since this is really my first sort of real program. I don't know, getting tired though.
Is there any short cut commands to make this occur? Thanks
Code:
//Assignment One CIS247 Joseph Matzke #include <cstdlib> #include <iomanip> #include <iostream> #include <string> using namespace std; struct movie { char rating; //G,PG,PG13,R17,X string movie; //Oceans 13, Oceans 12, Oceans 11, Braveheart, Harry Potter, Caligula bool releaseDate; //Still in theatre-released char language;//English E, Spanish S, Japanese J, Chinese C, German G, Swaheely S double cost[5]; double tax; }; void playMovie (movie); int main(void) { int choice = 0; //movie anyMovie; //declaration-creates object? movie movie1={'R', "Oceans 13", true, 'E', 19.99, .08}; //movie number 1 movie movie2={'R', "Oceans 12", false, 'E', 9.99}; movie movie3={'R', "Oceans 11", false, 'E', 9.99}; movie movie4={'R', "Braveheart", false, 'E', 9.99}; movie movie5={'G', "Harry Potter", false, 'E', 9.99}; movie movie6={'X', "Caligula", false, 'S', 1.99}; do { cout << "Please enter 0 to list all movies" << endl; //makes sense to display the menu for choice cout << "Pleae enter 99 to end the program" << endl; //either display the menu or stop the program cout << "Selection: "; cin >> choice; //cout << endl; << endl; } while (choice != 0 && choice !=99);//repeat if choice not 0 or 99 if (choice == 99) { system ("pause"); return 0; } if (choice == 0) { cout << setw(4) << "Oceans 13" << endl; cout << setw(4) << "Oceans 12" << endl; cout << setw(4) << "Oceans 11" << endl; cout << setw(4) << "Braveheart" << endl; cout << setw(4) <<"Harry Potter" << endl; cout << setw(4) << "Caligula" << endl; cout << setw(12) << "movie1" << endl; cout << setw(12) << "movie2" << endl; cout << setw(12) << "movie3" << endl; cout << setw(12) << "movie4" << endl; cout << setw(12) << "movie5" << endl; cout << setw(12) << "movie6" << endl; } system ("pause"); return 0; }
If there's anyway I'd appreciate it.
Joe
Comment