Advertisement
MeehoweCK

Untitled

Jun 11th, 2021
706
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. /*
  6. SKŁADNIA FUNKCJI
  7.  
  8. typ_zwracany nazwa_funkcji([argumenty funkcji])
  9. {
  10.     ciało_funkcji
  11. }
  12. */
  13.  
  14. void wypisz_powitanie()
  15. {
  16.     cout << "Hello world!\n";
  17. }
  18.  
  19. int suma(int a, int b)
  20. {
  21.     return a + b;       // zwrócenie wartości
  22. }
  23.  
  24. void wypisz_dzialanie_sumy(int a, int b)
  25. {
  26.     cout << a << " + " << b << " = " << a + b << endl;
  27. }
  28.  
  29. int main()
  30. {
  31.     wypisz_powitanie();     // wywołanie funkcji
  32.     cout << suma(10, 9) << endl;
  33.     wypisz_dzialanie_sumy(17, 50);
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement