Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- //vector <token*> vect;
- //class token {
- //
- //};
- //
- //class word : public token{
- //public:
- // string stringg;
- //
- //};
- //
- //class num : public token{
- //public:
- // int n;
- //};
- //void input(vector <token*> &vect) {
- // vect.push_back(new word);
- // vect.push_back(new num);
- //}
- //void split(int s, vector <token*>& vect) {
- // for (int i = 0; i < s.size(); i++) {
- // if (int(s[i]) > 47 & int(s[i])<58)
- //
- // }
- //
- //}
- class Box {
- public:
- vector<int*>v_num;
- vector<string*>v_word;
- };
- void split(string s, Box &db) {
- for (int i = 0; i < s.size();)
- {
- if (s[i] >= '0' && s[i] <= '9') {
- db.v_num.push_back(new int(s[i]));
- i++;
- }
- else {
- if (s[i] == ' ')
- i++;
- else {
- db.v_word.push_back(new string);
- *db.v_word[db.v_word.size() - 1] = s[i];
- i++;
- }
- }
- }
- }
- void print(Box db) {
- for (int i = 0; i < db.v_word.size() ; i++) {
- cout << *db.v_word[i];
- }
- }
- int main()
- {
- Box DB;
- setlocale(LC_ALL, "rus");
- string s = "Имя 145 фамилия 7495 и отчество ";
- split(s, DB);
- //s1 += s[i];
- print(DB);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement