Question

C++ ProgrammingWrite a function that takes an integer array, the array size and a number....

C++ Programming

Write a function that takes an integer array, the array size and a number. And it determines how many times that number appears in the array. Just copy the following code and paste it to your answer. And fill the corresponding part. 

#include < iostream >

using namespace atd; 

int howmany (int array lint , int number){

 //Your code comes here

}


 int main() {

const int N =10; 

int array[N] = [11,3,2,1,3,4,6,9,1.3); 

int count = howlany(array,N,3);

cout << 3 < "appesa" << cout << "times!";

 return 0;

3 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the required code for your problem

{ 1 #include <iostream> 2 using namespace std; 3 int howmany(int array[], int n, int number) 4-{ int count=0; for(int i=0;i<n

here is the code

#include
using namespace std;
int howmany(int array[],int n,int number)
{
int count=0;
for(int i=0;i {
//check equality and increase the counter
if (array[i]==number)
count=count+1;
}
//return count
return count;
}
int main()
{ const int n=10;
int array[n]={1,3,2,4,3,4,6,9,1,3};
int count=howmany(array,n,3);
cout<<3<<" appears "< return 0;
}

Answer #2
#include  
using namespace std; 
int howmany(int array[],int n,int number) 
{
 int count=0; 
 for(int i=0;i
                    
answered by: Shivani Sharma
Know the answer?
Add Answer to:
C++ ProgrammingWrite a function that takes an integer array, the array size and a number....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT