fork download
  1. //Mia Agramon CS1A Chapter 11, P.645, #2
  2. //
  3. /*******************************************************************************
  4.  * Movie Profit Display
  5.  * _____________________________________________________________________________
  6.  * This programs displays information about 2 movies including their production
  7.  * costs and first year revenues.
  8.  *
  9.  * INPUT
  10.  * Movie information
  11.  * OUTPUT
  12.  * Movie information
  13.  ******************************************************************************/
  14. #include <iostream>
  15. #include <string>
  16. #include <iomanip>
  17. using namespace std;
  18.  
  19. struct movieData
  20. {
  21. string title; //Movie Title
  22. string director; //Movie Director
  23. int yearReleased; //Year The Movie Was Released
  24. int runtime; //Movie Runtime In Minutes
  25. double productionCost; //Production Costs
  26. double firstYearRev; //First Year Revenue
  27. };
  28.  
  29. //Function Prototype
  30. void movieDisplay(movieData info);
  31.  
  32. int main()
  33. {
  34. //Input
  35. movieData evangelion = {"The End of Evangelion", "Hideaki Anno", 1997,
  36. 87, 9700000, 9261203.46};
  37. movieData hereditary = {"Hereditary", "Ari Aster", 2018, 127, 10000000,
  38. 44100000};
  39.  
  40. //Output
  41. movieDisplay(evangelion);
  42. movieDisplay(hereditary);
  43. return 0;
  44. }
  45.  
  46. //Function To Display Movie Data
  47. void movieDisplay(movieData info)
  48. {
  49. cout << fixed << setprecision(0) << endl;
  50. cout << "Title: " << info.title << endl;
  51. cout << "Director: " << info.director << endl;
  52. cout << "Year Released: " << info.yearReleased << endl;
  53. cout << "Runtime: " << info.runtime << " minutes" << endl;
  54. cout << "Production Cost: $" << info.productionCost << endl;
  55. cout << "First Year Revenue: $" <<info.firstYearRev << endl;
  56. }
Success #stdin #stdout 0s 5300KB
stdin
Standard input is empty
stdout
Title: The End of Evangelion
Director: Hideaki Anno
Year Released: 1997
Runtime: 87 minutes
Production Cost: $9700000
First Year Revenue: $9261203

Title: Hereditary
Director: Ari Aster
Year Released: 2018
Runtime: 127 minutes
Production Cost: $10000000
First Year Revenue: $44100000