Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 10.99 KB | None | 0 0
  1. #include<iostream>
  2. #include<math.h>
  3. using namespace std;
  4. int main ()
  5. {
  6.     int obecnie2;
  7.     int pot2;
  8.     int silnia;
  9.     int cont;
  10.     float reszta;
  11.     int razem = 0;
  12.     int liczba;
  13.     int obecnie = 1;
  14.     int dzialanie;
  15.     float x;
  16.     float y;
  17.     int obecnie3;
  18.     float wynik;
  19.     cont = 1;
  20.     while (cont == 1){
  21.  
  22.     cout << "KALKULATOR BY RECZEK" << endl;
  23.  
  24.     cout << "Co chcesz dzisiaj policzyc?" << endl;
  25.     cout << " Dodawanie 1" << endl;
  26.     cout << " Odejmowanie 2" << endl;
  27.     cout << " Mnozenie 3" << endl;
  28.     cout << " Dzielenie 4" << endl;
  29.     cout << " Pierwiastek kwadratowy 5" << endl;
  30.     cout << " Dzielniki 6" << endl;
  31.     cout << " Potegi 7" << endl;
  32.      cout << " Silnia 8" << endl;
  33.     cout << " Pierwiastek x stopnia 9" << endl;
  34.     cin >> dzialanie;
  35.  
  36.  
  37.         if(dzialanie ==1){
  38.             cout << "Podaj pierwsza liczbe: " << endl;
  39.                     cin >> x ;
  40.                     cout << endl;
  41.                     cout << "Podaj druga liczbe: " << endl;
  42.                     cin >> y;
  43.  
  44.                 wynik = x+y;
  45.                 cout << "Wynik: " << wynik ;}
  46.  
  47.         if(dzialanie == 2){
  48.             cout << "Podaj pierwsza liczbe: " << endl;
  49.             cin >> x ;
  50.             cout << endl;
  51.             cout << "Podaj druga liczbe: " << endl;
  52.             cin >> y;
  53.             wynik = x-y;
  54.             cout << "Wynik: " << wynik;}
  55.         if(dzialanie ==3){
  56.             cout << "Podaj pierwsza liczbe: " << endl;
  57.             cin >> x ;
  58.             cout << endl;
  59.             cout << "Podaj druga liczbe: " << endl;
  60.             cin >> y;
  61.             wynik = x*y;
  62.             cout << "Wynik: " << wynik;}
  63.  
  64.         if(dzialanie ==4){
  65.             cout<<"Podaj pierwsza liczbe: " << endl;
  66.                 cin >> x ;
  67.                 cout << endl;
  68.                 cout << "Podaj druga liczbe: " << endl;
  69.                 cin >> y;
  70.                 wynik= x/y;
  71.                 cout << "Wynik: " << wynik;}
  72.         if(dzialanie == 5){
  73.             cout << "Podaj liczbe: " << endl;
  74.             cin >> x ;
  75.             cout << endl;
  76.             wynik = sqrtf(x);
  77.             cout << "Wynik: " << wynik;
  78.         }
  79.         if (dzialanie ==6){
  80.             cout << "Podaj liczbe: " << endl;
  81.             cin >> liczba;
  82.              if(liczba>0){
  83.                 cout << "Dzielniki: ";
  84.                 for(;obecnie <= liczba; obecnie++){
  85.                 reszta = liczba % obecnie;
  86.                 if(reszta == 0){
  87.                 cout << obecnie << " ";
  88.                 razem++;
  89.         }
  90.  
  91.  
  92.                 }cout << endl << "Ilosc dzielnikow: " << razem;
  93.                 obecnie =1;
  94.  
  95. }
  96.  
  97.         }
  98.         if (dzialanie == 7){
  99.                     cout << "Podaj liczbe: " << endl;
  100.                     cin >> x;
  101.                     cout << "Podaj potege: " << endl;
  102.                     cin >> y;
  103.                     pot2 = x;
  104.                     if (x!= 0 and y >0){
  105.                             for(int potega = 1; potega < y; potega++){
  106.                                 wynik = pot2*x;
  107.                                 x = pot2*x;
  108.                             }
  109.                             cout << "Wynik: " << wynik;
  110.  
  111.                  
  112.  
  113.                     }else{
  114.                     if (y==0){
  115.                         cout << "Wynik: 1";
  116.                     }
  117.                     if(x==0){
  118.                         cout << "Wynik: 0";
  119.                     }
  120.                     }
  121.                 }
  122.         if(dzialanie==8){
  123.             cout << "Podaj liczbe: " << endl;
  124. cin >> x;
  125. if(x>0){
  126.             for(wynik=1;x>0;x--){
  127.                 wynik=wynik*x;
  128.             }
  129.            
  130.         }else{
  131.             if(x==0){
  132.                 cout <<"Wynik: 0" << endl;
  133.             }else{
  134.                 for(wynik=1;x<0;x++){
  135.                 wynik=wynik*x;
  136.             }
  137.             }
  138.         }cout<<"Wynik to: " << wynik << endl;}
  139.        
  140.         if(dzialanie==9){
  141.         cout << "Podaj liczbe: " << endl;
  142.         cin >> x;
  143.         cout << "Podaj stopien pierwiastka: " << endl;
  144.         cin >> y;
  145.             for(obecnie =1; obecnie <=x; obecnie++){obecnie3=1;
  146.                 for(obecnie2=1; obecnie2<=y; obecnie2++){
  147.                 obecnie3=obecnie3*obecnie;
  148.             }
  149.             if(obecnie3==x){
  150.                 wynik=obecnie3;
  151.             }
  152.             cout << "Wynik to: " << wynik;
  153.         }
  154.        
  155.             }
  156.             if (dzialanie == 666 or dzialanie == 2137){
  157.  
  158.                 cout << ";;;;;;;;;:::::::::::,,,,,,,........````````````````````````````..........,,,,,,,,::::::::::::" << endl;
  159. cout << ";;;;;;;;;:::::::::,,,,,,,,.........`````````````````````````````..........,,,,,,,,:::::::::::" << endl;
  160. cout << ";;;;;;;;::::::::::,,,,,,,.......````````````````````````````````````.......,,,,,,,:::::::::::" << endl;
  161. cout << ";;;;;;;;::::::::,,,,,,,.......````````````   ``  ```````````````````.......,,,,,,,::::::::::" << endl;
  162. cout << ";;;;;;::::::::::,,,,,,.......``````````` `   `   `     ``````````````.......,,,,,,::::::::::" << endl;
  163. cout << ";;;;;;::::::::::,,,,,.......``````````````` `,,,...`````  ````````````......,,,,,,,:::::::::" << endl;
  164. cout << ";;;:::::::::::,,,,,,,......`````````````` ,;:,,,. .````````  ``````````.....,,,,,,,,::::::::" << endl;
  165. cout << ";:::::::::::::,,,,,,......``````````   . ;;::,,,....````.``  ```````````......,,,,,,,:::::::" << endl;
  166. cout << ";::::::::::::,,,,,,,.....```````` `  ``.;+;,,;''';:,::::.``.  `` ````````......,,,,,,:::::::" << endl;
  167. cout << ";::::::::::::,,,,,,.....`````````    ``,;:+##++';'::,,,,.,+,   ` ````````......,,,,,,,::::::" << endl;
  168. cout << ";:::::::::::,,,,,.......````````     `+'#+';';;;;;:,,,,..,.:':` ` ````````.....,,,,,,:::::::" << endl;
  169. cout << ";::::::::::,,,,,,......```````    `` ++:'';;;;;:::;,,,......,,;.   ````````......,,,,,,:::::" << endl;
  170. cout << "::::::::::::,,,,,.....````````      @'';'''';;;:;:,,,,.,..,.,,,.`   ```````......,,,,,::::::" << endl;
  171. cout << ":::::::::::,,,,,......````````     ;'';''';;;;:::::,,,..,.,,,,,.,`  ```````......,,,,,,:::::" << endl;
  172. cout << ":::::::::::,,,,,,.....``````` `    .#+'''';;;;:;:::::,,,,,.,.,,,,.. `````````.....,,,,,,,::::"<< endl;
  173. cout << ":::::::::::,,,,,.......``````    ` #+'+''''';;;::::,:,,.,.,,,...,.`. ` ``````.....,.,,,,:::::"<< endl;
  174. cout << ":::::::::::,,,,,.....`.```````   `;++++''+';';;;:::,:,........,...,..  ```````......,,,,,::::"<< endl;
  175. cout << ":::::::::::,,,,,.....`````````    #+++++'+;''';:::,,,,,,,,,....,,,,., `````````.....,,,,,::::"<< endl;
  176. cout << "::::::::::,,,,,,.....````````    `@++++'++''''';:,,,,,,,,,,,..,,..,,,. ````````......,,,,,:::"<< endl;
  177. cout << "::::::::::,,,,,,.....```````      ++++++'+''++;;;;,,,,,,,,,,,,,,,,,,:,  ```````......,,,,,:::"<< endl;
  178. cout << ":::::::::,,,,,,.....```````    ` ,@+++'++++'';;;:,.:,,,,,,,,,,,,,,,,:,  ````````.....,,,,,,::"<< endl;
  179. cout << "::::::::::,,,,,.....```````    ` ;+'+++'++''';;;:,:.:::::::.,,,,,,,,:`  ````````.....,,,,,,::"<< endl;
  180. cout << "::::::::::,,,,,.....```````       ++'++'+'''+''';;,,;::,,,.,,,,,,,,:;   ````````.....,,,,,,::"<< endl;
  181. cout << ":::::::::,,,,,,....````````   `##.++'+'+++''''';;:,::,,,,,::,,,,,:::;   ````````.....,,,,,,::"<< endl;
  182. cout << ":::::::::,,,,,,....````````    '''#+'+++++'';;;;'::,,::::,,.,:,:,::;.   ````````.....,,,,,,::"<< endl;
  183. cout << ":::::::::,,,,,,....````````   .+++#+'++++'+++'';;':,;:;::,:.:,::,,:;    ````````.....,,,,,,::"<< endl;
  184. cout << ":::::::::,,,,,,....````````   :++++#++++#+++++#++'';::;::::,,,,,,,::``   ```````.....,,,,,,::"<< endl;
  185. cout << ":::::::::,,,,,,....````````   `#;+++++++#+''':;;++':::;;;;;::,,,,,,,:   ````````.....,,,,,,::"<< endl;
  186. cout << ":::::::::,,,,,,....````````    +'+++++++++'###;#+##':':;++';:::,,,,:;   ````````.....,,,,,,::"<< endl;
  187. cout << ":::::::::,,,,,,....````````   `@;+++++++':++':';'++'::'++#+;;;:,.,.,:   ````````.....,,,,,,::"<< endl;
  188. cout << ":::::::::,,,,,,....````````    .'+++++++';:+';;;:''',::;+'+'#::.,,:,`   ````````.....,,,,,,::"<< endl;
  189. cout << ":::::::::,,,,,,.....````````    +'#++++'';;:;;;;:'',,,:;''::,+;,,,;.     ```````.....,,,,,,,::"<< endl;
  190. cout << ":::::::::,,,,,,.....```````     #'+++++''';;:::;;'':.,,,:;::,,.,:,:,     ```````......,,,,,:,"<< endl;
  191. cout << ":::::::::,,,,,,.....```````   ` #++++++''';::::;'+':,,,,:,..,,,,,,,.``   ```````......,,,,,,,"<< endl;
  192. cout << ":::::::::,,,,,,......````````  `''+++++''';;:::;++;,,:,:::,:,,,,,:,    ````````......,,,,,,,,"<< endl;
  193. cout << ":::::::::,,,,,,......````````    #+++++++'';::;'+#;,,:::::,.,,,,,.,    ````````......,,,,,,,:"<< endl;
  194. cout << "::::::::,,,,,,,.......```````    `'#+++++''';+'';+;,,,,;;::,,,,,,,`    ````````.....,,,,,,,,:"<< endl;
  195. cout << ":::::::::,,,,,,.......```````     `@+++++'''';;#++;:,,,;';::::,,::     ````````.....,,,,,,,,,"<< endl;
  196. cout << ":::::,,,:,,,,,,.......```````     .#+++++''+'''+#++':::,:+;:::,,;``    ```````......,,,,,,,,,"<< endl;
  197. cout << ":::::,,,,,,,,,,,,.....````` ` ```,+#+++++';';+'+###+;,,,:'';:::,`    ````````.......,,,,,,,,,"<< endl;
  198. cout << ":::::::::,,,,,,,,.....``````` `;##+#+++++;:'+'''++;;,,,,,:+;;:,`     ````````.........,,,,,,,"<< endl;
  199. cout << ":::::::::,,,,,,,,......````.`@##+++++++'+;:;##''';:;:,,,,:;:::;` `   ````````..........,,,,::"<< endl;
  200. cout << ":::::::::,,,,,,,,......````.@#+#+++++++'+':'''+###;;;::;+;::::. `    ```````...........,,,,,,"<< endl;
  201. cout << ":::::::::,,,,,,,,.......`.`.+'#++++#++#'++;;+'+';,:,...,;::,;:```  `````````........`...,,,,,"<< endl;
  202. cout << ",:::::::::,,,,,,,........` #+##++'+++++'++';'''++';:::,,:,:,,,    `````````..............,,,,"<< endl;
  203. cout << "::::::::,:,,,,,,,,........'++++#+'++++#+++'';';';;;::::,,:,;: `   `````````............,,,,,,"<< endl;
  204. cout << "::::::::,:,,,,,,,,,.,.....++++++#'+++++++++';;;:;:,.,,::,:,;``````````````.......,,..,,.,,,,,"<< endl;
  205. cout << "::::::::::::,,,,,,,.,.`.,##+++++++++++++++++';:''::,,,:,:::`` ```````````........,,,,.,,,,,,,"<< endl;
  206. cout << ",:::::::::::,,,,,,,,.,`@+++'+++'+++'#++++++++;;'';:,:,,:,;+  ```````````.......,,,,,,,,,,,,::"<< endl;
  207. cout << ",,::::::::::,,,,,,,,,:+#+++'''+''++#'+++++++'+;';;;::,,:;;#:  `````````.......,,,,,,:,,:,::::"<< endl;
  208. cout << ",,,,,,,,,,,,,,,,,,,`++++++''+'''++'+#++++++++''''';+;;::',:+``````````........,,,,,,,::::::::"<< endl;
  209. cout << ",,,,,..,,,,,,,:,,,,#+++'+++''''''+''+++++++''+#';''+':;,+ .';;```````.......,,,,,,,,:::::::::"<< endl;
  210. cout << ":,,,...,,,,,,,:,,#+''';#+'#++;'''''''++#'+''''''+####::, `'#''''`.``........,,,,,,:::::::::::"<< endl;
  211. cout << ":,,,,..,,,,,,,:,@+;#';,';`+#+''''''''''+#+'''''';;;:``.`:..#''';'++:.`.....,,,,,,,,::::::::::"<< endl;
  212. cout << ":,,,,,,,,,,,::++###+#+#','+.'''''+''''+'++'';;;:::;..`.,.  :#';:+#,,+.....,,,,,,,,,::::::::::"<< endl;
  213. cout << "::,,::::::,;,##++'+''##@'':':#+'++;''+'+'+.;;:::,,,.`.`,.``.:;''+':':;,..,,,,,,,,,,,:::::::::"<< endl;
  214.  
  215.             }
  216.         if(dzialanie<1){
  217.                cout << "SERIO. CO CHCESZn OSIAGNAC?!"; }
  218.         if(dzialanie > 8 and dzialanie != 666 and dzialanie != 2137){
  219.             cout << ";-)"; }
  220.     cout << endl;
  221.     cout << "Czy chcesz kontynuowac? 1 - tak" << endl;
  222.     cin >> cont;
  223.     }
  224.     cout << "Reczek pozdrawia";
  225.    
  226. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement