Guest User

Untitled

a guest
Apr 25th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.66 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. while(1) {
  8. cout<<"Vítejte\n";
  9. cout<<"Kalkulacka 1.0.0\n";
  10. cout<<"Vyberte matematickou operaci:"<<endl;
  11. cout<<"MAXIMUM MATEMATICKYCH OPERANDU JE 5 !!!"<<endl;
  12. cout<<"1. scitani"<<endl;
  13. cout<<"2. odcitani"<<endl;
  14. cout<<"3. nasobeni"<<endl;
  15. cout<<"4. deleni"<<endl;
  16. int x,y;
  17. float a,b,c,d,e,v;
  18. cin >>x;
  19. }
  20.  
  21. if (x == 1){
  22. cout<< "Vybral jste scitani\n";
  23. cout<<" Nyni vyberte pocet matematickych operandu:"<<endl;
  24. cin>>y;
  25. if (y < 2) {
  26. cout<< "Musite scitat alespon 2 cisla!!!"<<endl;}
  27. else if (y ==2) {
  28. cout<<"Zadejte prvni operand:"<<endl;
  29. cin>>a;
  30. cout<<"Zadejte druhy operand"<<endl;
  31. cin>>b;
  32. v = a+b;
  33. cout<<"Vas vysledek je: "<<v<<endl;}
  34. else if (y ==3) {
  35. cout<<"Zadejte prvni operand:"<<endl;
  36. cin>>a;
  37. cout<<"Zadejte druhy operand"<<endl;
  38. cin>>b;
  39. cout<<"Zadejte treti operand"<<endl;
  40. cin>>c;
  41. v = a+b+c;
  42. cout<<"Vas vysledek je: "<<v<<endl;}
  43. else if (y ==4) {
  44. cout<<"Zadejte prvni operand:"<<endl;
  45. cin>>a;
  46. cout<<"Zadejte druhy operand"<<endl;
  47. cin>>b;
  48. cout<<"Zadejte treti operand"<<endl;
  49. cin>>c;
  50. cout<<"Zadejte ctvrty operand"<<endl;
  51. cin>>d;
  52. v = a+b+c+d;
  53. cout<<"Vas vysledek je: "<<v<<endl;}
  54. else if (y ==5) {
  55. cout<<"Zadejte prvni operand:"<<endl;
  56. cin>>a;
  57. cout<<"Zadejte druhy operand"<<endl;
  58. cin>>b;
  59. cout<<"Zadejte treti operand"<<endl;
  60. cin>>c;
  61. cout<<"Zadejte ctvrty operand"<<endl;
  62. cin>>d;
  63. cout<<"Zadejte paty operand"<<endl;
  64. cin>>e;
  65. v = a+b+c+d+e;
  66. cout<<"Vas vysledek je: "<<v<<endl;}
  67.  
  68.  
  69. }
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79. else if (x == 2) {
  80. cout<< "Vybral jste odcitani\n";
  81. cout<<" Nyni vyberte pocet matematickych operandu:"<<endl;
  82. cin>>y;
  83. if (y < 2) {
  84. cout<< "Musite odcitat alespon 2 cisla!!!"<<endl;}
  85. else if (y ==2) {
  86. cout<<"Zadejte prvni operand:"<<endl;
  87. cin>>a;
  88. cout<<"Zadejte druhy operand"<<endl;
  89. cin>>b;
  90. v = a-b;
  91. cout<<"Vas vysledek je: "<<v<<endl;}
  92. else if (y ==3) {
  93. cout<<"Zadejte prvni operand:"<<endl;
  94. cin>>a;
  95. cout<<"Zadejte druhy operand"<<endl;
  96. cin>>b;
  97. cout<<"Zadejte treti operand"<<endl;
  98. cin>>c;
  99. v = a-b-c;
  100. cout<<"Vas vysledek je: "<<v<<endl;}
  101. else if (y ==4) {
  102. cout<<"Zadejte prvni operand:"<<endl;
  103. cin>>a;
  104. cout<<"Zadejte druhy operand"<<endl;
  105. cin>>b;
  106. cout<<"Zadejte treti operand"<<endl;
  107. cin>>c;
  108. cout<<"Zadejte ctvrty operand"<<endl;
  109. cin>>d;
  110. v = a-b-c-d;
  111. cout<<"Vas vysledek je: "<<v<<endl;}
  112. else if (y ==5) {
  113. cout<<"Zadejte prvni operand:"<<endl;
  114. cin>>a;
  115. cout<<"Zadejte druhy operand"<<endl;
  116. cin>>b;
  117. cout<<"Zadejte treti operand"<<endl;
  118. cin>>c;
  119. cout<<"Zadejte ctvrty operand"<<endl;
  120. cin>>d;
  121. cout<<"Zadejte paty operand"<<endl;
  122. cin>>e;
  123. v = a-b-c-d-e;
  124. cout<<"Vas vysledek je: "<<v<<endl;}
  125. }
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. else if (x == 3) {
  134. cout<< "Vybral jste nasobeni\n";
  135. cout<<" Nyni vyberte pocet matematickych operandu:"<<endl;
  136. cin>>y;
  137. if (y < 2) {
  138. cout<< "Musite nasobit alespon 2 cisla!!!"<<endl;}
  139. else if (y ==2) {
  140. cout<<"Zadejte prvni operand:"<<endl;
  141. cin>>a;
  142. cout<<"Zadejte druhy operand"<<endl;
  143. cin>>b;
  144. v = a*b;
  145. cout<<"Vas vysledek je: "<<v<<endl;}
  146. else if (y ==3) {
  147. cout<<"Zadejte prvni operand:"<<endl;
  148. cin>>a;
  149. cout<<"Zadejte druhy operand"<<endl;
  150. cin>>b;
  151. cout<<"Zadejte treti operand"<<endl;
  152. cin>>c;
  153. v = a*b*c;
  154. cout<<"Vas vysledek je: "<<v<<endl;}
  155. else if (y ==4) {
  156. cout<<"Zadejte prvni operand:"<<endl;
  157. cin>>a;
  158. cout<<"Zadejte druhy operand"<<endl;
  159. cin>>b;
  160. cout<<"Zadejte treti operand"<<endl;
  161. cin>>c;
  162. cout<<"Zadejte ctvrty operand"<<endl;
  163. cin>>d;
  164. v = a*b*c*d;
  165. cout<<"Vas vysledek je: "<<v<<endl;}
  166. else if (y ==5) {
  167. cout<<"Zadejte prvni operand:"<<endl;
  168. cin>>a;
  169. cout<<"Zadejte druhy operand"<<endl;
  170. cin>>b;
  171. cout<<"Zadejte treti operand"<<endl;
  172. cin>>c;
  173. cout<<"Zadejte ctvrty operand"<<endl;
  174. cin>>d;
  175. cout<<"Zadejte paty operand"<<endl;
  176. cin>>e;
  177. v = a*b*c*d*e;
  178. cout<<"Vas vysledek je: "<<v<<endl;}}
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189. else if (x == 4) {
  190. cout<< "Vybral jste deleni\n";
  191. cout<<" Nyni vyberte pocet matematickych operandu:"<<endl;
  192. cin>>y;
  193. if (y < 2) {
  194. cout<< "Musite delit alespon 2 cisla!!!"<<endl;}
  195. else if (y ==2) {
  196. cout<<"Zadejte prvni operand:"<<endl;
  197. cin>>a;
  198. cout<<"Zadejte druhy operand"<<endl;
  199. cin>>b;
  200. v = a/b;
  201. cout<<"Vas vysledek je: "<<v<<endl;}
  202. else if (y ==3) {
  203. cout<<"Zadejte prvni operand:"<<endl;
  204. cin>>a;
  205. cout<<"Zadejte druhy operand"<<endl;
  206. cin>>b;
  207. cout<<"Zadejte treti operand"<<endl;
  208. cin>>c;
  209. v = a/b/c;
  210. cout<<"Vas vysledek je: "<<v<<endl;}
  211. else if (y ==4) {
  212. cout<<"Zadejte prvni operand:"<<endl;
  213. cin>>a;
  214. cout<<"Zadejte druhy operand"<<endl;
  215. cin>>b;
  216. cout<<"Zadejte treti operand"<<endl;
  217. cin>>c;
  218. cout<<"Zadejte ctvrty operand"<<endl;
  219. cin>>d;
  220. v = a/b/c/d;
  221. cout<<"Vas vysledek je: "<<v<<endl;}
  222. else if (y ==5) {
  223. cout<<"Zadejte prvni operand:"<<endl;
  224. cin>>a;
  225. cout<<"Zadejte druhy operand"<<endl;
  226. cin>>b;
  227. cout<<"Zadejte treti operand"<<endl;
  228. cin>>c;
  229. cout<<"Zadejte ctvrty operand"<<endl;
  230. cin>>d;
  231. cout<<"Zadejte paty operand"<<endl;
  232. cin>>e;
  233. v = a/b/c/d/e;
  234. cout<<"Vas vysledek je: "<<v<<endl;} }
  235. int o;
  236. cout<<"Chcete pokracovat, jestlize ano zadejte hodnotu 1, pokud nechete pokracovat zadejte hodnotu 0"<<endl;
  237. cin>>o;
  238. if (o == 0 ){
  239. break
  240. }
  241.  
  242.  
  243. }
Add Comment
Please, Sign In to add comment