Guest User

Untitled

a guest
May 26th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. #unclude<string>
  2. ....
  3. class Sentence {
  4.     string str;
  5. public:
  6.     Sentence(string a):str(a){};
  7. };
  8.  
  9. class InSentence: public Sentence {
  10. public:
  11.     InSentence(string a):str(a){};
  12. };
  13.  
  14. struct stSentence {
  15.     Sentence _str;
  16.     stSentence* next;
  17.     stSentence():_str(0),next(NULL){};
  18.     stSentence(Sentence* str):_str(str),next(NULL){};
  19. };
  20.  
  21. class Vector {
  22.     stSentence* _stSen;
  23.     int value;
  24. public:
  25.     void add_stSen(stSentence* stS){
  26.         if(!_stStn) {
  27.             _stStn = stS;
  28.         else {
  29.             stSentence* curr = new stSentence;
  30.             curr = stS;
  31.             curr->next = _stSen;
  32.             _stS = curr;
  33.         };
  34.         value++;       
  35.     }
  36.  
  37.     Vector():_stSen(NULL),value(0);
  38.     Vector(stSenstence* _stS) {    
  39.         add_stSen(_stS);
  40.     }
  41.  
  42.     Vector(string str) {
  43.         _len = strlen(str);
  44.         if(str[_len]='?')
  45.             Sentence* curr = new InSentence(str);
  46.         else
  47.             Sentence* curr = new Sentence(str);
  48.         stSentence*curr = new stSentence;
  49.         add_stSen(curr);
  50.     }
  51.  
  52.     typedef int* iterator;
  53.     iterator begin() {
  54.         return _stStn;
  55.     }
  56.     iterator end() {
  57.         return _stStn + value + 1;
  58.     }
  59. };
Add Comment
Please, Sign In to add comment