Rion96

Taschenrechner

Feb 12th, 2012
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.42 KB | None | 0 0
  1. x=0
  2. while x==0 do
  3. term.clear()
  4. term.setCursorPos(1,1)
  5. print"RE-Taschenrechner"
  6. print"Version 1.0"
  7. print"Optionen:"
  8. print"------------"
  9. print"1. Plus"
  10. print"2. Minus"
  11. print"3. Mal"
  12. print"4. Geteilt Durch"
  13. print"5. Beenden"
  14. write("?>")
  15. in1=read()
  16. if in1=="1" then
  17. term.clear()
  18. term.setCursorPos(1,1)
  19. print"Sie haben Plus gewaehlt!"
  20. print"Erste Zahl:"
  21. write("?>")
  22. plus1=read()
  23. print"Zweite Zahl:"
  24. write("?>")
  25. plus2=read()
  26. ergebnis=plus1 + plus2
  27. x=5
  28. end
  29. if in1=="2" then
  30. term.clear()
  31. term.setCursorPos(1,1)
  32. print"Sie haben Minus gewaehlt!"
  33. print"Erste Zahl:"
  34. write("?>")
  35. minus1=read()
  36. print"Zweite Zahl:"
  37. write("?>")
  38. minus2=read()
  39. ergebnis=minus1 - minus2
  40. x=5
  41. end
  42. if in1=="3" then
  43. term.clear()
  44. term.setCursorPos(1,1)
  45. print"Sie haben Mal gewaehlt!"
  46. print"Erste Zahl:"
  47. write("?>")
  48. mal1=read()
  49. print"Zweite Zahl:"
  50. write("?>")
  51. mal2=read()
  52. ergebnis=mal1 * mal2
  53. x=5
  54. end
  55. if in1=="4" then
  56. term.clear()
  57. term.setCursorPos(1,1)
  58. print"Sie haben Geteilt durch gewaehlt!"
  59. print"Erste Zahl:"
  60. write("?>")
  61. gtd1=read()
  62. print"Zweite Zahl:"
  63. write("?>")
  64. gtd2=read()
  65. ergebnis=gtd1 / gtd2
  66. x=5
  67. end
  68. if in1=="5" then
  69. print"Auf Wiedersehen"
  70. sleep(1)
  71. term.clear()
  72. term.setCursorPos(1,1)
  73. return
  74. end
  75. while x==5 do
  76. term.clear()
  77. term.setCursorPos(1,1)
  78. print"Das Ergebnis ist:"
  79. print""
  80. print(ergebnis)
  81. print""
  82. print"Druecken sie Enter um Zum Menue zurueckzukehren!"
  83. in2=read()
  84. x=0
  85. end
  86. x=0
  87. end
  88. return
Advertisement
Add Comment
Please, Sign In to add comment