fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. struct Movie {
  6. string title; // name of the movie
  7. string rating; // G, PG, PG-13, R, NC-17, NR
  8. int stars; // numbers of stars 0-4
  9. Movie ()
  10. {
  11. title = "No name provided";
  12. rating = "TBD";
  13. stars = -1;
  14. }
  15. }; // struct Movie
  16.  
  17. int main ()
  18. {
  19. Movie m1; // create an instance of a Movie
  20.  
  21. cout << "The movie title is " << m1.title <<
  22. " and its rating is " << m1.rating <<
  23. " and critics gave it " << m1.stars << " stars" << endl;
  24.  
  25. return(0);
  26. }
Success #stdin #stdout 0s 5320KB
stdin
The shit show
R
2
stdout
The movie title is No name provided and its rating is TBD and critics gave it -1 stars