Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. data-mining
  2. Header Files
  3. Book.h
  4. FileIOBooks.h
  5. Resource Files
  6. books.txt
  7. Source Files
  8. Book.cpp
  9. FileIOBooks.cpp
  10.  
  11. #include <string>
  12. using namespace std;
  13.  
  14. enum Genre {
  15. Horror,
  16. Romance,
  17. Fantasy,
  18. Thriller,
  19. Novel,
  20. Comedy
  21. };
  22.  
  23. class Book
  24. {
  25. private:
  26. string _author;
  27. string _title;
  28. unsigned int _bookId;
  29. unsigned int _price;
  30. Genre _genre;
  31. public:
  32. Book(string author, string title, unsigned int Id, unsigned int price, Genre genre);
  33. ~Book();
  34. };
  35.  
  36. #include "Book.h"
  37. Book::Book(string author, string title, unsigned int Id, unsigned int price, Genre genre) :
  38. _author(author),
  39. _title(title),
  40. _bookId(Id),
  41. _price(price),
  42. _genre(genre)
  43. {}
  44.  
  45. Book::~Book()
  46. {
  47. }
  48.  
  49. #include <sstream>
  50. #include <string>
  51. #include <fstream>
  52. #include "Book.h"
  53. #include <vector>
  54. #include <iostream>
  55. using namespace std;
  56.  
  57. class FileIOBooks
  58. {
  59. private :
  60. vector<Book> library;
  61. public:
  62. FileIOBooks();
  63. ~FileIOBooks();
  64. void booksProvider(const char* file);
  65. };
  66.  
  67. #include "FileIOBooks.h"
  68.  
  69.  
  70. FileIOBooks::FileIOBooks()
  71. {
  72. }
  73.  
  74.  
  75. FileIOBooks::~FileIOBooks()
  76. {
  77. }
  78.  
  79.  
  80. void FileIOBooks::booksProvider(const char* file)
  81. {
  82. string line;
  83. ifstream input(file);
  84. while (getline(input, line))
  85. {
  86. cout << "Parsing is not implemented yet!" << endl;
  87. }
  88. }
  89.  
  90. int main()
  91. {
  92. FileIOBooks provider;
  93. provider.booksProvider("books.txt");
  94. getchar();
  95. }
  96.  
  97. Mark Twain, Roughing It, 1, 10, Comedic
  98. Mark Twain, Eve's Diary, 2, 6, Romance
  99. Mark Twain, The Mysterious Stranger, 3, 6, Novel
  100. Mark Twain, The Gilded Age, 4, 12, Novel
  101. Charles Dickens, A Christmas Carol, 5, 5, Fantasy
  102. Charles Dickens, Oliver Twist, 6, 10, Novel
  103. Charles Dickens, Hard Times, 7, 3, Novel
  104. Charles Dickens, The Mystery of Edwin Drood, 8, 9, Novel
  105. William Shakespeare, King Lear, 9, 9, Thriller
  106. William Shakespeare, Macbeth, 8, 5, Horror
  107. William Shakespeare, Hamelt, 11, 11, Horror
  108. William Shakespeare, Romeo and Juliet, 12, 2, Romance
  109. William Shakespeare, The Tempest, 13, 15, Romance
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement