mitko2204

C# test

Jun 19th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.88 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Console.Write("Въведете израза:");
  10.             string t = Console.ReadLine();
  11.             if (Scobi(t)) Console.WriteLine("Правилно");
  12.             else Console.WriteLine("Неправилно");
  13.         }
  14.     }
  15. }
  16.  
  17. using System;
  18.  
  19. namespace ConsoleApp1
  20. {
  21.     //Comma
  22.     class Program
  23.     {
  24.         static void Main(string[] args)
  25.         {
  26.             Console.Write("Въведете текст - не повече от 255 знака");
  27.             string s = Console.ReadLine();
  28.             int br = 0;
  29.             for (int i = 0; i < s.Length; i++) if ( s [i] == ',') br++;
  30.             Console.Write("Знакът ',' се среща в теста "br+" пъти");
  31.         }
  32.     }
  33. }
  34.  
  35.  
  36. using System;
  37.  
  38. namespace ConsoleApp1
  39. {
  40.     //Prb???
  41.     class Program
  42.     {
  43.         static int Brar(string d, string s)
  44.         {
  45.             int i = s.IndexOf(d);
  46.             if (i == -1) return 0;
  47.             else return 1 + Brar(d, s.Substring(i + 1));
  48.         }
  49.         public static void Main()
  50.         {
  51.             Console.Write("Въведете текст - не повече от 255 знака!");
  52.             string t = Console.ReadLine();
  53.             int L = t.Length;
  54.             Console.Write("Въведете сума:");
  55.             string d = Console.ReadLine();
  56.             int k = 0; int br = 0; string pd;
  57.             do
  58.             {
  59.                 Ottdduma(t, ref k, out pd);
  60.                 if (pd.CompareTo("")!0) Console.WriteLine("Пор дума:" + pd);
  61.                 if (d.CompareTo(pd) == 0) Console.WriteLine(">>" + (++br) + ">>");
  62.             }
  63.             while (k < L);
  64.             Console.WriteLine("Брой срещания на "+d+" в текста е:" +br);
  65.         }
  66.     }
  67. }
  68.  
  69.  
  70.  
  71. using System;
  72.  
  73. namespace ConsoleApp1
  74. {
  75.     //Prb???
  76.     class Program
  77.     {
  78.        
  79.         public static void Main()
  80.         {
  81.             int[] a = new int[256 * 256]; char c;
  82.             Console.Write("ВЪВЕДИ ТЕКСТ:"); string s = Console.ReadLine();
  83.             for (c = 'А'; c <= 'я'; c++) a[c] = 0;
  84.             for (int i = 0; i < s.Length; i++) a[s[i]]++;
  85.             for (c = 'А'; c <= 'я'; c++)
  86.                 if (a[c] != 0) Console.WriteLine(c+":"+a[c]);
  87.         }
  88.         public static void Main()
  89.         {//Nidex - Брои всички знакове
  90.             int[] a = new int[256 * 256]; char c;
  91.             Console.Write("ВЪВЕДИ ТЕКСТ:"); string s = Console.ReadLine();
  92.             for (c = char.MinValue; c < char.MaxValue; c++) a[c] = 0;
  93.             for (int i = 0; i < s.Length; i++) a[s[i]]++;
  94.             for (c = char.MinValue; c < char.MaxValue; c++)
  95.                 if (a[c] != 0) Console.WriteLine(c + ":" + a[c]);
  96.         }
  97.     }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment