Facebook
From Bistre Madrill, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 247
  1. #include "stdafx.h"
  2. #include "iostream"
  3. #include "vector"
  4. using namespace std;
  5.  
  6. void wypisz(vector<int>liczby)
  7. {
  8.         for (int i = 0; i < liczby.size(); i++)
  9.         {
  10.                 cout << liczby[i] << ",";
  11.         }
  12.         cout << endl;
  13. }
  14.  
  15. int suma(vector<int>liczby)
  16. {
  17.         int wynik = 0;
  18.         for (int i = 0; i < liczby.size(); i++)
  19.         {
  20.                 wynik += liczby[i];
  21.         }
  22.         return wynik;
  23. }
  24.  
  25. int dodaj(int x, int y)
  26. {
  27.         return x + y;
  28. }
  29.  
  30. int odejmij(int x, int y)
  31. {
  32.         return x - y;
  33. }
  34.  
  35. int _tmain(int argc, _TCHAR* argv[])
  36. {
  37.         vector<int>liczby;
  38.         liczby.push_back(7);
  39.         liczby.push_back(1);
  40.         liczby.push_back(2);
  41.         wypisz(liczby);
  42.         cout << "suma liczb to : " << suma(liczby) << endl;
  43.         int x = dodaj(5, 3);
  44.         int y = odejmij(x, 4);
  45.         cout << "wynik dodawania to : " << x << endl;
  46.         cout << "wynik dodawania to : " << y << endl;
  47.         cout << "Mama" << endl;
  48.         system("pause");
  49. }
  50.  
  51.