Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- namespace FundamentalsIntro
- {
- public class Program
- {
- public static void Main()
- {
- bool boolean;
- int integer;
- double floatPoint;
- char character;
- while(true)
- {
- string line = Console.ReadLine();
- if(line == "END")
- {
- break;
- }
- bool isInteger = int.TryParse(line, out integer);
- bool isDouble = double.TryParse(line, out floatPoint);
- bool isChar = char.TryParse(line, out character);
- bool isBoolean = bool.TryParse(line, out boolean);
- if(isInteger)
- {
- Console.WriteLine("{0} is integer type", integer);
- }
- else if(isDouble)
- {
- Console.WriteLine("{0} is floating point type", line);
- }
- else if(isChar)
- {
- Console.WriteLine("{0} is character type", character);
- }
- else if(isBoolean)
- {
- Console.WriteLine("{0} is boolean type", line);
- }
- else
- {
- Console.WriteLine("{0} is string type", line);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement