Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int a;
- int suma1;
- void uzupelnianie(int tab[], int a)
- {
- for(int i=0; i<a; i++)
- {
- cout<<"Podaj element tablicy"<<endl;
- cin >> tab[i];
- }
- }
- void wyswietl(int tab[], int a)
- {
- for(int i=0; i<a; i++)
- {
- cout<<tab[i]<<endl;
- }
- }
- int suma(int tab[], int a)
- {
- for(int i=0; i<a; i++)
- {
- suma1 = suma1 + tab[i];
- }
- return suma1;
- }
- int main()
- {
- int tab[a];
- cout << "Podaj rozmiar tablicy: ";
- cin >> a;
- uzupelnianie(tab,a);
- cout<<"Wyswietlam tablice"<<endl;
- wyswietl(tab,a);
- cout<<"Suma wszystkich elementow tablicy wynosi: "<<suma(tab, a);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement