Guest User

Untitled

a guest
Jun 26th, 2016
66
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace _08.Convert
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. var value = double.Parse(Console.ReadLine());
  10. var input = Console.ReadLine();
  11. // Enter m , mm , cm , mi , inch , km , ft , yd
  12. var output = Console.ReadLine();
  13. // Enter m , mm , cm , mi , inch , km , ft , yd
  14.  
  15. var meter = 1;
  16. var mm = 1000;
  17. var cm = 100;
  18. var mi = 0.000621371192;
  19. var pesho = 39.3700787;
  20. var km = 0.001;
  21. var ft = 3.2808399;
  22. var yd = 1.0936133;
  23.  
  24. switch (input)
  25. {
  26. case "m":
  27. break;
  28. case "mm":
  29. value = value / mm;
  30. break;
  31. case "cm":
  32. value = value / cm;
  33. break;
  34. case "mi":
  35. value = value / mi;
  36. break;
  37. case "in":
  38. value = value / pesho;
  39. break;
  40. case "km":
  41. value = value / km;
  42. break;
  43. case "ft":
  44. value = value / ft;
  45. break;
  46. case "yd":
  47. value = value / yd;
  48. break;
  49. default:
  50. break;
  51. }
  52. switch (output)
  53. {
  54. case "m":
  55. break;
  56. case "mm":
  57. value = value * mm;
  58. break;
  59. case "cm":
  60. value = value * cm;
  61. break;
  62. case "mi":
  63. value = value * mi;
  64. break;
  65. case "in":
  66. value = value * pesho;
  67. break;
  68. case "km":
  69. value = value * km;
  70. break;
  71. case "ft":
  72. value = value * ft;
  73. break;
  74. case "yd":
  75. value = value * yd;
  76. break;
  77. default:
  78. break;
  79.  
  80. }
  81. Console.WriteLine(value + " " + output);
  82. }
  83. }
  84. }
RAW Paste Data