Advertisement
MaksNew

Untitled

Feb 15th, 2021
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <regex>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     setlocale(LC_ALL, "ru");
  8.     SinglyLinkedList<int> list;
  9.  
  10.     string inputline;
  11.     cmatch res;
  12.  
  13.     regex regular("^(\\d+\\s*)+$"); //для проверки
  14.     getline(cin, inputline);
  15.     if (!(regex_match(inputline.c_str(), regular)))
  16.         cout << "sosi xui";
  17.  
  18.     regex reg("^[(\\d+)\\s*]+$"); //для захвата
  19.     if (regex_search(inputline.c_str(), res, reg))
  20.         for (size_t i = 1; i < res.size(); ++i)
  21.             cout << res[i] << endl;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement