Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- 49 namespace ConsoleApp1//тип данни
- {
- class Program
- {
- static void Main(string[] args)
- {
- string command = Console.ReadLine();
- while (command != "END")
- {
- bool intTryParseIsSucceess = int.TryParse(command, out int intValue); //стринг към инт
- //стринг към доубле
- bool doubleTryParseIsSuccess = double.TryParse(command, out double doubleValue)
- bool charTryParseIsSuccess = char.TryParse(command, out char charValue); //стринг към чар
- bool boolTryParseIsSuccess = bool.TryParse(command, out bool boolValue);
- //стринг към боол
- if (intTryParseIsSucceess)
- {
- Console.WriteLine($"{command} is integer type");
- }
- else if (doubleTryParseIsSuccess)
- {
- Console.WriteLine($"{command} is floating point type");
- }
- else if (boolTryParseIsSuccess)
- {
- Console.WriteLine($"{command} is boolean type");
- }
- else if (charTryParseIsSuccess)
- {
- Console.WriteLine($"{command} is character type");
- }
- else
- {
- Console.WriteLine($"{command} is string type");
- }
- command = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement