1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sweet-ann [11.9K]
3 years ago
6

Write a program that declares an array named myArray with 8 components of the type int. Initialize the array to 8 values that th

e user inputs (remember to prompt the user). Finally, pass the array as a parameter to a new function called filterEvens. This new function will display all of the even numbers in the array.
Computers and Technology
1 answer:
Savatey [412]3 years ago
6 0

Answer:

#include <iostream>

using namespace std;

void filterEvens(int myArray[]) {

   for (int i = 0; i < 8; ++i) {

     if(myArray[i]%2==0){

         cout<<myArray[i]<<" ";

     }

  }

}

int main(){

   int myArray[8];

   for(int i =0;i<8;i++){

       cin>>myArray[i];

   }

   filterEvens(myArray);

   return 0;

}

Explanation:

The solution is provided in C++

#include <iostream>

using namespace std;

The function filerEvens is defined here

void filterEvens(int myArray[]) {

This iterates through the elements of the array

   for (int i = 0; i < 8; ++i) {

This checks if current element is an even number

     if(myArray[i]%2==0){

If yes, this prints the array element

         cout<<myArray[i]<<" ";

     }

  }

}

The main begins here

int main(){

This declares an integer array of 8 elements

   int myArray[8];

The following iteration allows input into the array

<em>    for(int i =0;i<8;i++){</em>

<em>        cin>>myArray[i];</em>

<em>    }</em>

This calls the defined function filter Evens

   filterEvens(myArray);

   return 0;

}

You might be interested in
ANSWER QUICKLY!
patriot [66]

Answer:

It is bit { measurement used to quantify computer data. }

7 0
3 years ago
Written one please answer
Zinaida [17]

Answer:

So where the question????????

8 0
2 years ago
Makes it possible to distribute both power and data using ethernet cabling. select one:
Nimfa-mama [501]
It would be: 

b.) poe cable 

message me on my profile if you need any more help! :) 
6 0
3 years ago
Display the cost of landscaping a backyard with sod that is sold by the square foot and fencing that is sold by the foot. The in
Ipatiy [6.2K]

Answer:

length = float(input("Enter length of the backyard in foot: "))

width = float(input("Enter width of the backyard in foot: "))

sod_price = float(input("Enter the price of sod per square foot: "))

fencing_price = float(input("Enter the price of fencing per foot: "))

area = length * width

perimeter = 2 * (length + width)

cost = sod_price * area + fencing_price * perimeter

print("The cost of landscaping is $" + str(cost))

Explanation:

*The code is in Python.

Ask the user to enter the length, width, sod_price, and fencing_price

Calculate the area and perimeter of the backyard

Calculate the cost, sod_price * area + fencing_price * perimeter

Print the cost

7 0
4 years ago
6. Suppose you’re assisting with a cable installation using fiber-optic cabling that will support Gigabit Ethernet. You’re appro
Natalka [10]

Answer:

You will use Single Mode Fiber (SMF).

Explanation:

SMF is the best option in this case since we will be installing segments of up to 4000m. SMF is known for its capability to maintain a high-quality signal and practically zero degradation across long distances.

5 0
4 years ago
Other questions:
  • Can someone help me with...A table can help? PLEASE
    8·1 answer
  • Which statement accurately compares the restart at 1 and continue numbering featured of word
    15·2 answers
  • 2. Write a Python regular expression to replace all white space with # in given string “Python is very simple programming langua
    14·1 answer
  • ______allow you to select elements that are in a certain state, such as when the mouse if hovering over an element
    14·1 answer
  • Read the scenario and then answer the question using only the information provided.
    7·1 answer
  • Write a program that takes a list of integers as input. The input begins with an integer indicating the number of integers that
    8·1 answer
  • Which group scope can be used to assign permissions to resources only in the domain in which the group is created
    12·1 answer
  • This feature in Word Online allows you to view your document to see what it will look like when printed.
    6·2 answers
  • If the disaster requires actions offsite from the primary infrastructure, it is under the jurisdiction of__________.
    7·1 answer
  • Please help me on this it’s due now
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!