Advertisement
Guest User

TocnoRijesen

a guest
Sep 2nd, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.59 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 ConsoleApplication2
  8. {
  9.     class Program
  10.     {
  11.         struct RetrunFromFunction
  12.         {
  13.             public bool semicolon;
  14.             public bool comma;
  15.             public bool period;
  16.         }
  17.  
  18.         static void Main(string[] args)
  19.         {
  20.             Console.Write("Enter string: ");
  21.             var input = Console.ReadLine();
  22.             var Result = Function(input);
  23.  
  24.             Console.WriteLine("Ima tocku: " + Result.comma);
  25.             Console.WriteLine("Ima zarez: " + Result.period);
  26.             Console.WriteLine("Ima tocku zarez: " + Result.semicolon);
  27.  
  28.             Console.WriteLine("Press any key to terminate");
  29.             Console.ReadLine();
  30.         }
  31.  
  32.         private static RetrunFromFunction Function(string input)
  33.         {
  34.             var Result = new RetrunFromFunction
  35.             {
  36.                 semicolon = false,
  37.                 comma = false,
  38.                 period = false
  39.             };
  40.  
  41.             for (int i = 0; i < input.Length; i++)
  42.             {
  43.                 switch (input[i])
  44.                 {
  45.                     case '.':
  46.                         Result.period = true;
  47.                         break;
  48.                     case ',':
  49.                         Result.period = true;
  50.                         break;
  51.                     case ';':
  52.                         Result.semicolon = true;
  53.                         break;
  54.                 }
  55.             }
  56.             return Result;
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement