#include<iostream>
usingnamespace std;
int Prime (int array_[5], int st) {
int array_f[5];
int m=0;
int k=0;
do
{
int e=1;
for (int i=2; i<st; i++){
if (st%i==0)
{
e=0;
break;
}
}
if(e==1){array_f[k]=st;k+=1;m+=st;}
st+=1;
}// do
while(k==4);
m/=5;
return m;
}
int main(){
int b=23;
cout<<Prime(b);
return 0;
}
Line 3: The Prime function expects two arguments, the first of which is an array (which you never use... do you?), but you call it on line 40 with only one int.
That's the cause of your error. Your code may have other issues (I haven't run it, but some parts look off).
int Ave( int sm){
int k=0;
do
{
int e=1;
for (int i=2;i<sm;i++){
if (sm%i==0){e=0;break;}
}
if (e==1){cout<<k<<" " <<sm<<endl;k=k+1;}
sm=sm+1;
}
while(k<5);
return k;
}
int main(){
int x=100;
cout<<Ave(x);
return 0;
}
then, the values I got (5 of them) I wanted to put into an array,
int Ave(int array_f[5], int sm){
int k=0;
do
{
int e=1;
for (int i=2;i<sm;i++){
if (sm%i==0){e=0;break;}
}
if (e==1){array_f[k]=sm; cout<<k<<" "<<sm<<" "<<array_f[k]<<endl;k=k+1;}
sm=sm+1;
}
while(k<5);
return k;
}
int main(){
int x=128;
cout<<Ave(x);
return 0;
}