Witam
napotkałem problem podczas pisania programu i nie potrafię go rozwiązać
ów program wygląda tak :
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
void tworzTab(int t[], int n);
void wypisz(int t[],int n);
void suma(int t[],int n);
int main()
{
cout<<"podaj wielkosc tablicy"<<endl;
int n,c;
cin>>n;
int tab[n];
tworzTab(tab,n);
wypisz(tab,n);
c=suma(tab ,n );
cout<<suma<<endl;
return 0;
}
void tworzTab(int t[], int n){
for(int i=0; i<n; i++){
t[i]=rand()%12-5;
}
}
void wypisz(int t[],int n){
for(int i=0; i<n; i++){
cout.width(4);
cout<<t[i];
}
}
void suma(int t[],int n){
int suma=0;
for(int i=0; i<n; i++){
suma+=t[i];
}
}
a problem który wystąpił to:
main.cpp: In function ‘int main()’:
main.cpp:27:19: error: void value not ignored as it ought to be
c=suma(tab ,n );
^