Advertisement
MeehoweCK

Untitled

Mar 12th, 2024
810
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void funkcja1() {
  6.     cout << "To jest funkcja, ktora nic nie zwraca\n";
  7. }
  8.  
  9. int funkcja2() {
  10.     cout << "Ta funkcja zwraca wartosc 5\n";
  11.     return 5;
  12. }
  13.  
  14. int main() {
  15.     //auto value{ funkcja1() };     nie można nic przypisać do value, gdyż funkcja1 nic nie zwraca (jest typu void)
  16.     auto wartosc{ funkcja2() };     // tutaj da się przypisać wartość, gdyż funkcja2 zwraca wartość typu int
  17.     cout << "Zwrocona wartosc wynosi " << wartosc << endl;
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement