Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- void Dodaj(float a, float b) //Dodawanie
- {
- cout << "podaj dwie liczby, ktore chcesz dodac" <<endl;
- cin >> a;
- cin >> b;
- float Wynik = a + b;
- cout << a << "+" << b << "=" << Wynik << endl;
- cout << endl;
- }
- void Odejmij(float a, float b) //Odejmowanie
- {
- cout << "podaj dwie liczby, ktore chcesz odjac" <<endl;
- cin >> a;
- cin >> b;
- float Wynik = a - b;
- cout << a << "-" << b << "=" << Wynik << endl;
- cout << endl;
- }
- void Podziel(float a, float b) //Dzielenie
- {
- cout << "podaj dwie liczby, ktore chcesz podzielic" << endl;
- cin >> a;
- cin >> b;
- float Wynik = a / b;
- cout << a << "/" << b << "=" << Wynik << endl;
- cout << endl;
- }
- void Pomnoz(float a, float b) //Mnozenie
- {
- cout << "podaj dwie liczby, ktore chcesz pomnozyc" << endl;
- cin >> a;
- cin >> b;
- float Wynik = a * b;
- cout << a << "*" << b << "=" << Wynik << endl;
- cout << endl;
- }
- main()
- {
- int Opcja;
- cout << "jakie dzielenie chcesz wykonac?" << endl;
- cout << "1. Dodawanie" << endl;
- cout << "2. Odejmowanie" << endl;
- cout << "3. Dzielenie" << endl;
- cout << "4. Mnozenie" << endl;
- cin >> Opcja;
- switch(Opcja)
- {
- float a;
- float b;
- case 1: Dodaj(a, b);
- break;
- case 2: Odejmij(a, b);
- break;
- case 3: if (b == 0)
- cout << "Nie dzielimy przez zero" << endl;
- else Podziel(a, b);
- break;
- case 4: Pomnoz(a, b);
- break;
- default: cout << "Nieznana opcja" << endl;
- }
- system ("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement