Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int dodaj(int x, int y)
- {
- return x + y;
- }
- int odejmij(int x, int y)
- {
- return x - y;
- }
- int pomnoz(int x, int y)
- {
- return x * y;
- }
- float podziel(float x, float y)
- {
- return(float) (x / y);
- }
- int main ()
- {
- std::cout << "KALKULATOR" << std::endl;
- std::cout << " " << std::endl;
- std::cout << "1. Dodawanie" << std::endl;
- std::cout << "2. Odejmowanie" << std::endl;
- std::cout << "3. Mnożenie" << std::endl;
- std::cout << "4. Dzielenie" << std::endl;
- int x,y;
- std::cout << "Podaj dwie liczby:" << std::endl;
- std::cin >> x >> y;
- std::cout << "Suma wynosi:" << dodaj(x,y) << std::endl;
- std::cout << "Różnica wybosi:" << odejmij(x,y) << std::endl;
- std::cout << "Iloczyn wynosi:" << pomnoz(x,y) << std::endl;
- std::cout << "Iloraz wynosi:" << podziel(x,y) << std::endl;
- if(1=dodaj) {
- suma: x+y;
- std::cout << "Suma wynosi: " << suma << std:endl;
- } else {
- if(2=odejmij) {
- suma: x-y;
- std::cout << "Różnica wynosi: " << roznica << std:endl;
- } else {
- if(3=pomnoz) {
- suma: x*y;
- std::cout << "Iloczyn wynosi: " << iloczyn << std:endl;
- } else {
- if(4=pomnoz) {
- suma: x/y;
- std::cout << "Iloraz wynosi: " << iloraz << std:endl;
- } else
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement