Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace DataTypeFinder
- {
- class Program
- {
- static void Main()
- {
- string s;
- char c;
- int i;
- double d;
- bool b;
- string command = Console.ReadLine();
- while (command != "END")
- {
- Type type = command.GetType();
- string dataType =
- bool.TryParse(command, out b) ? "boolean" :
- int.TryParse(command, out i) ? "integer" :
- double.TryParse(command, out d) ? "floating point" :
- char.TryParse(command, out c) ? "character" : "string";
- Console.WriteLine($"{command} is {dataType} type");
- command = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement