Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string>
- #include <time.h>
- #include <windows.h>
- #include <conio.h>
- #include "klasa_1.h"
- using namespace std;
- Kalkulator::Kalkulator(float xx, float yy, int wwybor, float wwynik)
- {
- x = xx;
- y = yy;
- wybor = wwybor;
- wynik = wwynik;
- }
- Kalkulator::~Kalkulator()
- {
- cout<<endl<<"Trwa czyszczenie danych..."<<endl<<endl;
- }
- void Kalkulator::kMenu()
- {
- cout<<endl<<"1.Dodawanie \n";
- cout<<"2.Odejmowanie \n";
- cout<<"3.Mnozenie \n";
- cout<<"4.Dzielenie \n";
- cout<<"5.Potegowanie \n";
- cout<<"6.Wylacz program \n";
- cout<<endl<<"Wybor: ";
- cin>>wybor;
- cout<<endl;
- }
- void Kalkulator::kWyciagnij()
- {
- cout<<"Podaj 1 liczbe: ";
- cin>>x;
- cout<<"Podaj 2 liczbe: ";
- cin>>y;
- }
- void Kalkulator::kOblicz()
- {
- switch(wybor)
- {
- case 1: wynik = x + y; break;
- case 2: wynik = x - y; break;
- case 3: wynik = x * y; break;
- case 4: wynik = x / y; break;
- case 5: wynik = pow(x, y); break;
- case 6: ; exit(0); break;
- default: cout<<"Nie podales zadnych zmiennych";
- }
- }
- void Kalkulator::kPokazWynik()
- {
- cout<<"Wynik twojego dzialania wynosi: "<<wynik;
- getchar();getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement