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
Find at least three software programs for each of the two technologies listed below.
lakkis [162]

Answer:

Android Studio, FileZila

Explanation:

Android studio provides you with all tools you need to build a mobile application l.

FileZila is an FTP controller, you cam DELETE , SEND, RECIEVE data from it.

7 0
3 years ago
Read 2 more answers
even if we reach that state where an AI can behave as human does,how do we measure if AI is acting like a human?
xxTIMURxx [149]

A person can be able to measure if AI is acting like a human by the use of   Turing test.

<h3>How do we measure of artificial intelligence is acting like a human?</h3>

One can measure if AI is  Acting humanly via the use of a human who is said to interrogates the program and also the use of another person through the use of a terminal simultaneously.

Note that If after some amount of time or period, the interrogator is said to be unable to tell which is which, the program is said to have passed. To pass this test it is one that needs natural language processing.

Hence, A person can be able to measure if AI is acting like a human by the use of Turing test.

Learn more about AI from

brainly.com/question/25523571

#SPJ1

4 0
1 year ago
What is better tower in tower defense simulator roblox
Morgarella [4.7K]

The commander is a tower that boosts the firerate of towers within its range.

Explanation:

The support towers are towers that helps you by giving you more cash or boosting your towers. It can be purchased in the store and its appearance resembles that of an officer standing on a wooden pedestal.

Support towers are towers that indirectly helps you, either by giving you more cash or boosting your towers.

There are 40 waves of zombie's in tower defence simulator. Modes are the difficult games in tower defence simulator that is available to play on standard maps.

It is unlocked by using the code " UPDATEINMINUTE2019" in the text box in the bottom left of the menu screen.

3 0
3 years ago
Read 2 more answers
Chuck plans to go on a hiking trip. Before the hiking trip, Chuck's bank account has $129.50. He then spends $129.50 on hiking g
iragen [17]

Chuck plans to go on a hiking trip. Before the hiking trip ...

Aug 18, 2011 · Hiking Yellowstone National Park ... and though I only had 48 hours to spend in the park this trip, I tried to make the most of it. I drove the entire 152 mile Grand Loop circle, stopping

3 0
3 years ago
Assume that an O(log2N) algorithm runs for 10 milliseconds when the input size (N) is 32. What input size makes the algorithm ru
NARA [144]

Answer:

An input size of N = 128 makes the algorithm run for 14 milliseconds

Explanation:

O(log2N)

This means that the running time for an algorithm of length N is given by:

F(N) = c\log_{2}{N}

In which C is a constant.

Runs for 10 milliseconds when the input size (N) is 32.

This means that F(32) = 10

So

F(N) = c\log_{2}{N}

10 = c\log_{2}{32}

Since 2^5 = 32, \log_{2}{32} = 5

Then

5c = 10

c = \frac{10}{5}

c = 2

Thus:

F(N) = 2\log_{2}{N}

What input size makes the algorithm run for 14 milliseconds

N for which F(N) = 14. So

F(N) = 2\log_{2}{N}

14 = 2\log_{2}{N}

\log_{2}{N} = 7

2^{\log_{2}{N}} = 2^7

N = 128

An input size of N = 128 makes the algorithm run for 14 milliseconds

5 0
3 years ago
Other questions:
  • Trish uas bought a new computer, which she plans to start working on aftwr a week. Since Trish has not used computers in the pas
    13·1 answer
  • How is ( a || b ) &amp;&amp; c || ( a || b ) &amp;&amp; ( ! c ) equal to ( a || b ) without simplification?
    8·1 answer
  • This is not homework but how do you fix this I’ve tried everything
    9·1 answer
  • Which of the following statements is true with regards to satellite Internet access?
    13·2 answers
  • Now write a program named GreenvilleRevenue that prompts a user for the number of contestants entered in last year’s competition
    6·1 answer
  • ASAP: Type the correct answer in the box. Spell all words correctly.
    11·1 answer
  • How can using Prezi software for a presentation allow the presenter to better respond to audience needs?
    10·1 answer
  • 1. Which sentence best expresses the main idea
    12·1 answer
  • 9.6 Code Practice, this is in Python, I need its quick!
    13·1 answer
  • X = 9 % 2<br><br> if (x == 1):<br>   print ("ONE")<br> else:<br>   print ("TWO")
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!