Advertisement
Mandrah

zad6cw5

Nov 22nd, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.02 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <string>
  5. using namespace std;
  6.  
  7. // ZROBIŁEM TYLKO DO LICZBY 3 TE TABLICZKI, BO NIE CHCIAŁO MI SIĘ DO 9 ROZPISYWAĆ (ZA DUŻO PISANIA TEGO W LINIJKACH / KOPIOWANIA / ZMIENIANIA)
  8. int main()
  9. {
  10. int liczba, n;
  11. cout << "Wprowadz liczbe:";
  12. cin >> liczba;
  13.  
  14. cout << "[1] Dodawanie" << endl;
  15. cout << "[2] Odejmowanie" << endl;
  16. cout << "[3] Mnozenie" << endl;
  17. cout << "[4] Dzielenie" << endl;
  18. cin >> n;
  19. cout << endl << endl;
  20.  
  21. switch (n)
  22. {
  23. case 1:
  24.     cout << "dodawanie" << "\t" << "1" << "\t" << "2" << "\t" << "3" << endl;
  25.     cout << "--------------------------------------" << endl;
  26.     cout << "wybrana:" << liczba << "\t" << liczba+1 << "\t" << liczba+2 << "\t" << liczba+3 << endl;
  27.     break;
  28.  
  29. case 2:
  30.     cout << "odejmowanie" << "\t" << "1" << "\t" << "2" << "\t" << "3" << endl;
  31.     cout << "--------------------------------------" << endl;
  32.     cout << "wybrana:" << liczba << "\t" << liczba-1 << "\t" << liczba-2 << "\t" << liczba-3 << endl;
  33.     break;
  34.  
  35. case 3:
  36.     cout << "mnozenie" << "\t" << "1" << "\t" << "2" << "\t" << "3" << endl;
  37.     cout << "--------------------------------------" << endl;
  38.     cout << "wybrana:" << liczba << "\t" << liczba*1 << "\t" << liczba*2 << "\t" << liczba*3 << endl;
  39.     break;
  40.  
  41. case 4:
  42.     int m;
  43.     cout << "[1] Dzielenie calkowite" << endl;
  44.     cout << "[2] Dzielenie rzeczywsite" << endl;
  45.     cin >> m;
  46.     switch(m)
  47.     {
  48.     case 1:
  49.     cout << "dzielenie" << "\t" << "1" << "\t" << "2" << "\t" << "3" << endl;
  50.     cout << "--------------------------------------" << endl;
  51.     cout << "wybrana:" << liczba << "\t" << liczba/1 << "\t" << liczba/2 << "\t" << liczba/3 << endl;
  52.     break;
  53.  
  54.     case 2:
  55.     cout << "dzielenie" << "\t" << "1" << "\t" << "2" << "\t" << "3" << endl;
  56.     cout << "--------------------------------------" << endl;
  57.     cout << "wybrana:" << liczba << "\t" << (float)liczba/1 << "\t" << (float)liczba/2 << "\t" << (float)liczba/3 << endl;
  58.     break;
  59.     }
  60. }
  61. return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement