SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 1 Day Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 16 Dec 2017 My Price 10.00

array of any constantly declared array size variabl

Write a function called fillArray that will fill an array of any constantly declared array size variable with random numbers in the range of 1 - 100.

Write a function called printArray that will print an array of any size.

Write a third function called countEvens which will count and return the number of even numbers in the array.

 

In main create an array that holds 25 ints. Use your functions to fill, print, and count the number of even numbers. You should

 

  1. Fill the array
  2. Print the array
  3. Print the number of even numbers in the array

 

What not to do:

 

  • Using any of the following will drop your grade for this assignment by an automatic 10 points
  • global variables
  • cout in any function other than main and printArray
  • goto statements

 

image.jpg

I have everything down except for the third function. I am drawing blanks.

#include <iostream>
#include <ctime>
#include <stdlib.h>
using namespace std;

void printArray(int arr[], int size);
int countevens(int arr[], int size);

int main()
{
    srand(time(0));
    const int size = 25;
    int fillArray[size];

    cout << endl;
    for (int i = 0; i < size; i++)
    {
        fillArray[i] = rand() % 99 + 1;
    }

    printArray(fillArray, size);

    return 0;
}

void printArray(int arr[], int size)
{
    cout << "Printing the array" << endl;
    for (int i = 0; i < size; i++)
    {
        cout << arr[i] << endl;
    }
    return ;
}
int countevens(int arr[], int size)
int evencount = 0;
{
    for (int i = 0; i < size; i++)
        if (arr[i] % 2 == 0)
            evencount++;
    {
        cout << "There are " << evencount << " even numbers in the array" << endl;
    }

    return evencount;

}


Attachments:

Answers

(5)
Status NEW Posted 16 Dec 2017 03:12 PM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)