Fenrir112

%u041F%u043E%u0434%u0441%u0447%u0435%u0442 %u0441%u043B%u043E%u0432 %u0438 %u0441%u0438%u043C%u0432%u043E%u043B%u043E%u0432

Dec 24th, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1.         static void Count()
  2.         {
  3.             Console.WriteLine("Введите строку для подсчета в ней слов и букв");
  4.             int ch = 0, wd = 1;
  5.             string st = Console.ReadLine();
  6.             while (st != "")
  7.             {
  8.                 if (st[0] == ' ')
  9.                 {
  10.                     wd++;
  11.                 }
  12.                 else
  13.                 {
  14.                     ch++;
  15.                 }
  16.                 st = st.Remove(0, 1);
  17.             }
  18.             Console.WriteLine("Букв: {0}\nСлов: {1}", ch, wd);
  19.         }
Advertisement
Add Comment
Please, Sign In to add comment