Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- using namespace std;
- void wypelnij(float tab[], int r)
- {
- for(int i=0; i<r; i++)
- {
- cout << "Podaj element tablicy:" << endl;
- cin >> tab[i];
- system("cls");
- }
- }
- void wyswietl(float tab[], int r)
- {
- for(int i=0; i<r; i++)
- {
- cout << tab[i] << " ";
- }
- cout << endl;
- }
- float suma(float tab[], int r)
- {
- float x=0;
- for(int i=0; i<r; i++)
- {
- x = x + tab[i];
- }
- return x;
- }
- int main()
- {
- int r;
- cout << "Podaj rozmiar tablicy:" << endl;
- cin >> r;
- float tab[r];
- system("cls");
- wypelnij(tab, r);
- wyswietl(tab, r);
- cout << "Suma wynosi: " << suma(tab, r);
- return 0;
- }
Add Comment
Please, Sign In to add comment