fork download
  1. //Mia Agramon CS1A Chapter 11, P.645, #1
  2. //
  3. /*******************************************************************************
  4.  * Movie Data
  5.  * _____________________________________________________________________________
  6.  * This program will display information about 2 movies using a struct.
  7.  *
  8.  * INPUT
  9.  * Movie data
  10.  * OUTPUT
  11.  * Movie data
  12.  ******************************************************************************/
  13. #include <iostream>
  14. #include <string>
  15. using namespace std;
  16.  
  17. struct movieData
  18. {
  19. string title; //Movie Title
  20. string director; //Movie Director
  21. int yearReleased; //Year The Movie Was Released
  22. int runtime; //Movie Runtime In Minutes
  23. };
  24.  
  25. //Function Prototype
  26. void movieDisplay(movieData info);
  27.  
  28. int main()
  29. {
  30. //Input
  31. movieData evangelion = {"The End of Evangelion", "Hideaki Anno", 1997,
  32. 87};
  33. movieData hereditary = {"Hereditary", "Ari Aster", 2018, 127};
  34.  
  35. //Output
  36. movieDisplay(evangelion);
  37. movieDisplay(hereditary);
  38. return 0;
  39. }
  40.  
  41. //Function To Display Movie Data
  42. void movieDisplay(movieData info)
  43. {
  44. cout << "Title: " << info.title << endl;
  45. cout << "Director: " << info.director << endl;
  46. cout << "Year Released: " << info.yearReleased << endl;
  47. cout << "Runtime: " << info.runtime << " minutes" << endl;
  48. }
Success #stdin #stdout 0.01s 5308KB
stdin
Standard input is empty
stdout
Title: The End of Evangelion
Director: Hideaki Anno
Year Released: 1997
Runtime: 87 minutes
Title: Hereditary
Director: Ari Aster
Year Released: 2018
Runtime: 127 minutes