Advertisement
Fundamentalen

PlayWithVars

Mar 20th, 2014
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2.  
  3. class PlayWithVars
  4. {
  5.     static void Main()
  6.     {
  7.         Console.WriteLine("Please choose type:");
  8.         Console.WriteLine("1 --> int");
  9.         Console.WriteLine("2 --> double");
  10.         Console.WriteLine("3 --> string");
  11.         int choice = int.Parse(Console.ReadLine());
  12.  
  13.         switch (choice)
  14.         {
  15.             case 1:
  16.                 Console.Write("Please enter a int: ");
  17.                 int choiceOne = int.Parse(Console.ReadLine());
  18.                 Console.WriteLine(choiceOne + 1);
  19.                 break;
  20.             case 2:
  21.                 Console.Write("Please enter a double: ");
  22.                 double choiceTwo = double.Parse(Console.ReadLine());
  23.                 Console.WriteLine(choiceTwo + 1);
  24.                 break;
  25.             case 3:
  26.                 Console.Write("Please enter a double: ");
  27.                 string choiceThree = Console.ReadLine();
  28.                 Console.WriteLine(choiceThree + "*");
  29.                 break;
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement