Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication2
- {
- class Program
- {
- struct RetrunFromFunction
- {
- public bool semicolon;
- public bool comma;
- public bool period;
- }
- static void Main(string[] args)
- {
- Console.Write("Enter string: ");
- var input = Console.ReadLine();
- var Result = Function(input);
- Console.WriteLine("Ima tocku: " + Result.comma);
- Console.WriteLine("Ima zarez: " + Result.period);
- Console.WriteLine("Ima tocku zarez: " + Result.semicolon);
- Console.WriteLine("Press any key to terminate");
- Console.ReadLine();
- }
- private static RetrunFromFunction Function(string input)
- {
- var Result = new RetrunFromFunction
- {
- semicolon = false,
- comma = false,
- period = false
- };
- for (int i = 0; i < input.Length; i++)
- {
- switch (input[i])
- {
- case '.':
- Result.period = true;
- break;
- case ',':
- Result.period = true;
- break;
- case ';':
- Result.semicolon = true;
- break;
- }
- }
- return Result;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement