Guest User

Untitled

a guest
May 27th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <deque>
  4. #include <iterator>
  5. #include <string>
  6. #include <fstream>
  7. using namespace std;
  8.  
  9. class Book
  10. {
  11. protected:
  12.     deque<string> m_Book;
  13. public:
  14.     Book(char* filename)
  15.     {
  16.         string a;
  17.         ifstream file(filename,ios::in);
  18.         while(!file.eof())
  19.         {
  20.             file>>a;
  21.             m_Book.push_back(a);
  22.         }
  23.     }
  24.     void print()
  25.     {
  26.         string c;
  27.         for(int i=0;i<m_Book.size();i++)
  28.         {
  29.             c=m_Book[i];
  30.             cout<<c<<" ";
  31.         }
  32.            
  33.     }
  34.     string& strToLower(string& s)
  35.     {
  36.         transform(s.begin(),s.end(),s.begin(),::tolower);
  37.         return s;
  38.     }
  39.     void ToLower()
  40.     {
  41.         transform(m_Book.begin(),m_Book.end(),m_Book.begin(),strToLower);
  42.     }
  43. };
  44. int main()
  45. {
  46.     Book b("book.txt");
  47.     b.print();
  48.    
  49. }
Add Comment
Please, Sign In to add comment