Facebook
From pkrc, 6 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 343
  1. #include <iostream>
  2. #include "stdafx.h"
  3. #include <conio.h>
  4. //using namespace std;
  5.  
  6. void wypiszTablice(int tablica[], int ile)
  7. {
  8.         for (int indeks = 0; indeks < ile; indeks++)
  9.                 std::cout << tablica[indeks] << std::endl;
  10.  
  11. }
  12.  
  13. int sumujLiczby(int tablica[], int ile)
  14. {
  15.         int oblicz = 0;
  16.         for (int indeks = 0; indeks < ile; indeks++)
  17.                 oblicz += tablica[indeks];
  18.  
  19.         return oblicz;
  20. }
  21.  
  22. int main()
  23. {
  24.         int dane[5];
  25.         dane[0] = 11;
  26.         dane[1] = 5;
  27.         dane[2] = 7;
  28.         dane[3] = 8;
  29.         dane[4] = 2;
  30.         wypiszTablice(dane, 5);
  31.        
  32.         int wynik = sumujLiczby(dane, 5);
  33.         std::cout << "Suma liczb wynosi = " << wynik << std::endl;
  34.        
  35.         _getch();
  36.         return 0;
  37. }
  38.  

Replies to Untitled rss

Title Name Language When
Re: Untitled Round Capybara cpp 6 Years ago.