ch11_1 movie data

//

//http://www.cplusplus.com/doc/tutorial/structures/

// example about structures

#include <iostream>

#include <string>

#include <sstream>

using namespace std;

struct movie_data {

string title;

string director;

int year;

int running_time;

} movie1, movie2, movie3;

void printmovie (movie_data movie);

movie_data make_movie();

int main ()

{

string mystr;

movie_data movie1 ={"Aliens","James Cameron",1986,137};

make_movie();

 

/*

cout << "Enter title: ";

getline (cin,movie3.title);

cout << "Enter director: ";

getline (cin,mystr);

stringstream(mystr) >> movie3.director;

cout << "Enter year: ";

getline (cin,mystr);

stringstream(mystr) >> movie3.year;

cout << "Enter running time: ";

getline (cin,mystr);

stringstream(mystr) >> movie3.year;*/

/*

cout << "My favorite movie is:\n ";

printmovie (movie2);

cout << "And yours is:\n ";

printmovie (movie3);

cout << "Another great movie is :\n";

printmovie(movie1);

*/

movie_data md[9];

md[1] = make_movie();

printmovie(md[1]);



printmovie(movie1);

//printmovie(movie2);

return 0;

}

movie_data make_movie(){



movie_data movie2 ={"...And Justice For All", "Norman Jewison", 1979, 119};

}

void printmovie (movie_data movie)

{

cout<<"movie info"<<endl;

cout<<""<<movie.title<<endl;

cout<<""<<movie.year<<endl;

cout<<""<<movie.director<<endl;

cout<<""<<movie.running_time<<endl;



 

/*

cout << movie.title;

cout << " (" << movie.year << ")\n";*/

}

Popular posts from this blog

ch11 review silberschatz operating systems concepts essentials 2nd ed