Please Need Help in Assignment As soon As possible

Write a program that counts number of prime numbers in an Array. The program must be able to use functions, in particular, The program must use the count as reference variable in main.
This is not a homework site. We won't do your homework for you. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.

We didn't see your attempts to solve this problem yourself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again. As it is impossible to find derivative of function without knowledge in arithmetic, you cannot do more complex tasks in programming without clear understanding of basics
What specifically are you having problems with? What code have you written so far? Is this an array of bits or of integers? Please provide us with more detail on the assignment and the code that you currently working with.
The quicker we get rid of him, the better it is.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <cmath>
using namespace std;
int isprime(int a)
{
for(int i=2;i<sqrt(a);i++)
if(a%i==0)
return 0;
return 1;
}
int main() {
int contor=0;
int n;
cin>>n;
int s;
for(int i=0;i<n;i++)
{
cin>>s;
contor+=isprime(s);
}
cout<<contor<<endl;
return contor;
}

It first reads how many number it should read then reads n numbers and shows how many are prime. Don't be a beggar. Learn it by yourself.
Registered users can post here. Sign in or register to post.