darkhelmet125

movieType.cpp

Dec 7th, 2011
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.43 KB | None | 0 0
  1. /*Matt Short
  2. Assignment 7
  3. CPSC 131
  4. Purpose: Implement the functions created in the class MovieType.h*/
  5. //IMPLEMENTATION FILE (MOVIETYPE.H)
  6. #include<iostream>
  7. #include"movieType.h"
  8. #include<string>
  9. #include<fstream>
  10. using namespace std;
  11.  
  12. MovieType::MovieType()
  13. {
  14. }
  15.  
  16. bool MovieType::readMovieInfo(ifstream& readFile)
  17. {
  18.     //Get rank
  19.     readFile>>rank;
  20.     if(rank>=1)         //Checks to see if rank is valid
  21.     {
  22.         readFile>>weight;//Stores weight
  23.         readFile>>year;//Stores year
  24.         readFile>>votes;//Stores votes
  25.         readFile>>genre;//Stores genre
  26.         readFile>>length;//Stores length
  27.         getline(readFile,title);//Stores title
  28.         return true;    //Returns Success
  29.      }
  30.      else               //Terminates if less than 1.
  31.          return false;
  32. }
  33.  
  34. void MovieType::printMovieInfo(ofstream& printFile)
  35. {
  36.     printFile<<title<<" "<<year<<" "<<genre<<" "<<length<<" "<<rank<<" "<<weight<<" "<<votes<<" "<<endl;
  37. }
  38.  
  39. char MovieType::getGenre()
  40. {
  41.     return genre;
  42. }
  43.  
  44. int MovieType::getRank()
  45. {
  46.     return rank;
  47. }
  48.  
  49. bool MovieType::operator>=(MovieType check) const//check is of type MovieType
  50. {
  51.     if(rank >= check.rank)//checks if rank is <= the other rank
  52.         return true;
  53.     else
  54.         return false;
  55. }
  56.  
  57. bool MovieType::operator>(MovieType check2) const//check2 is of type MovieType
  58. {
  59.     if(rank > check2.rank)//checks if rank is < the other rank
  60.         return true;
  61.     else
  62.         return false;
  63. }
  64.  
  65. MovieType::~MovieType()
  66. {
  67. }
  68.  
Add Comment
Please, Sign In to add comment