Advertisement
allia

арифметика

Feb 11th, 2021
608
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. using System;
  2. using System.Text;  
  3. using System.Text.RegularExpressions;
  4. using System.Collections.Generic;
  5.  
  6. class MainClass
  7. {
  8.   public static void Main (string[] args)
  9.   {
  10.     string chislo = @"(([1-9])\d*)";
  11.     string pattern = $"({chislo}[-*+/])";
  12.     string all_pattern = $"{pattern}*{chislo}";
  13.     string str = Console.ReadLine();
  14.  
  15.     while(true)
  16.     {
  17.        foreach (Match match in Regex.Matches(str, all_pattern))
  18.          Console.WriteLine(match.Value);
  19.  
  20.       str = Console.ReadLine();
  21.        if (String.IsNullOrEmpty(str))
  22.           break;
  23.     }
  24.   }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement