I am trying to print out prime from array. I have viewed other sources that are similar and tried to use as reference, but only to confuse myself.This is what i have so far.
void get_output(int&Max,int array[])
{
//array[i]-i; no idea what his does
for(i=1;i<=10;i++) // allow 10 outputs on a line.
{
for(int i=0;i<Max;i++)
{
prime=true;
if(Max%i==0)
{
prime =false;
elsereturntrue;
}
}
}
cout<<endl;
}
# include <iostream>
// and stuff of # include...
// other functions...
bool isPrime (int Max);
bool answer = true;
for (int i = 2; i <= sqrt(Max); ++i )
if (Max % i == 0)
{
answer = false;
break;
}
return answer;
}
int main()
{
// your code that gives Max
.....................
if(isPrime (Max))
cout << "Prime: " << Max << '\n';
// the rest of your code......
return 0;
}