Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <cstdlib>
- #include <conio.h>
- #include <math.h>
- using namespace std;
- float x, y;
- char wybor;
- int potega(int px, int py) {
- int pz;
- for(int i=2; i < py; i++) {
- px=px*px;
- }
- return px;
- }
- int main()
- {
- for(;;)
- {
- cout << "Podaj 1 liczbe: "<<endl;
- cin >>x;
- cout<<"Podaj 2 liczbe: "<<endl;
- cin>>y;
- cout<<endl;
- cout<<"MENU GLOWNE"<<endl;
- cout<<"--------------"<<endl;
- cout<<"1. Dodawanie"<<endl;
- cout<<"2. Odejmowanie"<<endl;
- cout<<"3. Mnozenie"<<endl;
- cout<<"4. Dzielenie"<<endl;
- cout<<"5. Potegowanie"<<endl;
- cout<<"6. Wyjscie"<<endl;
- cout<<"--------------"<<endl;
- cout<<endl;
- wybor=getch();
- switch (wybor)
- {
- case '1':
- cout<<"Suma = "<<x+y;
- break;
- case '2':
- cout<<"Roznica = "<<x-y;
- break;
- case '3':
- cout<<"Iloczyn = "<<x*y;
- break;
- case '4':
- if (y==0) cout<< "Nie dzieli sie przez 0 :)"; // super, Åže pamietasz o blokowaniu bugowania ;)
- else cout<<"Iloraz = "<< x/y;
- break;
- case '5':
- cout<<"Potega = "<< potega (x,y);
- break;
- case '6':
- exit(0);
- break;
- default: cout<<"Nie ma takiej opcji w menu!";
- } // case end
- getchar();getchar();
- system("cls");
- } // for end
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement