Advertisement
Guest User

Untitled

a guest
Nov 11th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.29 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string>
  6. #include <time.h>
  7. #include <windows.h>
  8. #include <conio.h>
  9. #include "klasa_1.h"
  10.  
  11. using namespace std;
  12.  
  13. Kalkulator::Kalkulator(float xx, float yy, int wwybor, float wwynik)
  14. {
  15.     x = xx;
  16.     y = yy;
  17.     wybor = wwybor;
  18.     wynik = wwynik;
  19. }
  20. Kalkulator::~Kalkulator()
  21. {
  22.     cout<<endl<<"Trwa czyszczenie danych..."<<endl<<endl;
  23. }
  24. void Kalkulator::kMenu()
  25. {
  26.     cout<<endl<<"1.Dodawanie \n";
  27.     cout<<"2.Odejmowanie \n";
  28.     cout<<"3.Mnozenie \n";
  29.     cout<<"4.Dzielenie \n";
  30.     cout<<"5.Potegowanie \n";
  31.     cout<<"6.Wylacz program \n";
  32.     cout<<endl<<"Wybor: ";
  33.     cin>>wybor;
  34.     cout<<endl;
  35. }
  36. void Kalkulator::kWyciagnij()
  37. {
  38.     cout<<"Podaj 1 liczbe: ";
  39.     cin>>x;
  40.     cout<<"Podaj 2 liczbe: ";
  41.     cin>>y;
  42. }
  43. void Kalkulator::kOblicz()
  44. {
  45.     switch(wybor)
  46.     {
  47.         case 1: wynik = x + y; break;
  48.         case 2: wynik = x - y; break;
  49.         case 3: wynik = x * y; break;
  50.         case 4: wynik = x / y; break;
  51.         case 5: wynik = pow(x, y); break;
  52.         case 6: ; exit(0); break;
  53.         default: cout<<"Nie podales zadnych zmiennych";
  54.     }
  55. }
  56. void Kalkulator::kPokazWynik()
  57. {
  58.     cout<<"Wynik twojego dzialania wynosi: "<<wynik;
  59.     getchar();getchar();
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement