Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.68 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void readable_nums(ref string k)
  12.         {
  13.             int i = 3;
  14.             int m = k.Length;
  15.             while (i <m)
  16.             {
  17.                 k = k.Insert(m - i, ".");
  18.                 i += 3;
  19.             }
  20.         }
  21.         static void no_subs(ref string s, string subs)
  22.         {
  23.             while(s.Contains(subs))
  24.             s = s.Replace(subs, "");
  25.  
  26.         }
  27.         static void middle_symbol_replacement(ref string s)
  28.         {
  29.             //Console.WriteLine(s.Length % 2);
  30.             //Console.WriteLine(s.Length / 2);
  31.             s =s.Remove(s.Length / 2, 2-(s.Length % 2));
  32.            
  33.         }
  34.         static void Main(string[] args)
  35.         {
  36.             Console.Write("Введите s:");
  37.             string s = Console.ReadLine();
  38.             Console.Write("Введите subs:");
  39.             string subs = Console.ReadLine();
  40.             string dots = s;
  41.             string k = s;
  42.             string m = s;
  43.             string f = s;
  44.             readable_nums(ref k);
  45.             no_subs(ref m, subs);
  46.             middle_symbol_replacement(ref f);
  47.             Console.WriteLine("Результат первой задачи:"+k);
  48.             Console.WriteLine("Результат второй задачи:" + m);
  49.             Console.WriteLine("Результат третьей задачи:" + f);
  50.             //Console.WriteLine("Результат исполнения второй задачи:"+s.Replace())
  51.             Console.Read();
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement