Advertisement
rosenrusev

PlayWithDoubleAndString

Mar 22nd, 2014
1,394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. using System;
  2.  
  3. namespace PlayWithIntDoubleAndString
  4. {
  5. class PlayWithDoubleAndString
  6. {
  7. static void Main()
  8. {
  9. Console.WriteLine("Please, choose a type:\n1 --> int\n2 --> double\n3 --> string");
  10. int choice = int.Parse(Console.ReadLine());
  11.  
  12. switch (choice)
  13. {
  14. case 1: Console.Write("Please enter a integer: ");
  15. int a = int.Parse(Console.ReadLine());
  16. Console.WriteLine(a + 1);
  17. break;
  18. case 2: Console.Write("Please enter a double: ");
  19. double b = double.Parse(Console.ReadLine());
  20. Console.WriteLine(b + 1.00);
  21. break;
  22. case 3: Console.Write("Please enter a string: ");
  23. string c = Console.ReadLine();
  24. Console.WriteLine(c + "*");
  25. break;
  26. default: Console.WriteLine("Not correct choice!"); break;
  27. }
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement