Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. using namespace std;
  4.  
  5. void moja_funkcja()
  6. {
  7.     cout<<"[1] dodawanie"<<endl;
  8.     cout<<"[2] odejmowanie"<<endl;
  9.     cout<<"[3] mnozenie"<<endl;
  10.     cout<<"[4] dzielenie"<<endl;
  11.     cout<<"[5] wyjscie z programu"<<endl;
  12. }
  13.  
  14. void dodawanie()
  15. {
  16.     int x, y;
  17.     cin>>x>>y;
  18.     cout<<"wynik "<<x+y<<endl;
  19.     Sleep(1800);
  20. }
  21.  
  22. void odejmowanie()
  23. {
  24.     int x, y;
  25.     cin>>x>>y;
  26.     cout<<"wynik "<<x-y<<endl;
  27.     Sleep(1800);
  28. }
  29.  
  30. void mnozenie()
  31. {
  32.     int x, y;
  33.     cin>>x>>y;
  34.     cout<<"wynik "<<x*y<<endl;
  35.     Sleep(1800);
  36. }
  37. void dzielenie()
  38. {
  39.     int x, y;
  40.     cin>>x>>y;
  41.     cout<<"wynik "<<x/y<<endl;
  42.     Sleep(1800);
  43. }
  44.  
  45. int main()
  46. {
  47.     cout << "W programie sa nastepujaceopcje: " << endl;
  48.     //moja_funkcja();
  49.     int liczba, x, y;
  50.     do
  51.     {
  52.         system("cls");
  53.      moja_funkcja();
  54.      cin>>liczba;
  55.    //  cout<<"podaj x i y";
  56.    //  cin>>x>>y;
  57.      switch(liczba)
  58.      {
  59.          case 1:
  60.              dodawanie();
  61.              break;
  62.         case 2:
  63.             odejmowanie();
  64.             break;
  65.         case 3:
  66.              mnozenie();
  67.              break;
  68.         case 4:
  69.              dzielenie();
  70.              break;
  71.             default:
  72.             break;
  73.      }
  74.     } while(liczba !=5);
  75.  
  76.  
  77.     return 0;
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement