Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. #include <stdio.h>
  2. int main(){
  3. double b, c;
  4. char a, d;
  5. etykieta:
  6.  
  7. puts("Mo¿liwe do wykonania operacje :");
  8. puts("1. Dodawanie (+)");
  9. puts("2. Odejmowanie (-)");
  10. puts("3. Mno¿enie (*)");
  11. puts("4. Dzielenie (/)");
  12. puts("5. Reszta z dzielenia (%)");
  13. puts("Podaj operacjê, któr¹ chcesz wykonaæ :");
  14. scanf("%c", &a);
  15. printf("Podaj pierwsz¹ liczbê :");
  16. scanf("%lf", &b);
  17. printf("Podaj drug¹ liczbê :");
  18. scanf("%lf", &c);
  19.  
  20. switch(a){
  21. case '+' :
  22. goto etykieta1;
  23. break;
  24. case '-' :
  25. goto etykieta2;
  26. break;
  27. case '*' :
  28. goto etykieta3;
  29. break;
  30. case '/' :
  31. goto etykieta4;
  32. break;
  33. case '%' :
  34. goto etykieta5;
  35. break;
  36. }
  37.  
  38.  
  39. etykieta1:
  40. printf("Wynik operacji : %lf+%lf=%lf", b, c, b+c);
  41. printf("Czy chcesz kontynuowaæ kolejne operacje? (T/N)");
  42. scanf("%c", d);
  43.  
  44. switch(d){
  45. case'T' :
  46. goto etykieta;
  47. break;
  48. case'N':
  49. return 0;
  50. break;
  51. }
  52.  
  53.  
  54. etykieta2:
  55. printf("Wynik operacji : %lf+%lf=%lf", b, c, b-c);
  56. printf("Czy chcesz kontynuowaæ kolejne operacje? (T/N)");
  57. scanf("%c", d);
  58.  
  59. switch(d){
  60. case'T' :
  61. goto etykieta;
  62. break;
  63. case'N':
  64. return 0;
  65. break;
  66. }
  67.  
  68.  
  69. etykieta3:
  70. printf("Wynik operacji : %lf+%lf=%lf", b, c, b*c);
  71. printf("Czy chcesz kontynuowaæ kolejne operacje? (T/N)");
  72. scanf("%c", d);
  73.  
  74. switch(d){
  75. case'T' :
  76. goto etykieta;
  77. break;
  78. case'N':
  79. return 0;
  80. break;
  81.  
  82.  
  83. }
  84. etykieta4:
  85. printf("Wynik operacji : %lf+%lf=%lf", b, c, b/c);
  86. printf("Czy chcesz kontynuowaæ kolejne operacje? (T/N)");
  87. scanf("%c", d);
  88.  
  89. switch(d){
  90. case'T' :
  91. goto etykieta;
  92. break;
  93. case'N':
  94. return 0;
  95. break;
  96. }
  97. etykieta5:
  98. printf("Wynik operacji : %lf+%lf=%lf", b, c, b%c);
  99. printf("Czy chcesz kontynuowaæ kolejne operacje? (T/N)");
  100. scanf("%c", d);
  101.  
  102. switch(d){
  103. case'T' :
  104. goto etykieta;
  105. break;
  106. case'N':
  107. return 0;
  108. }
  109.  
  110. return 0;
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement