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
The most important hardware device for connecting supercomputers over a wide area
juin [17]

Answer:

Hel

Explanation:

I think that they are:

  • <u>Processo</u><u>rs</u><u>:</u> Super computers posses tens of thousands of processors for performing billions of intensive computations on a single second.
  • <u>Memory</u><u>:</u> Supercomputers feature high volumes of memory, which allows the unit to access information at a given time.

7 0
3 years ago
How long will it take Lola to travel from Paris to nice?
Alisiya [41]

the answer is 5,000 hours.

I recommend you post these kind of questions in the mathematics section

4 0
4 years ago
You work as a network technician for uCertify Inc. You have erased data saved in your laptop. You still have many device configu
zloy xaker [14]

Answer:

Data remanence

Explanation:

Data remanence is the retention of erased data on a magnetic medium. Sensitive detection systems can pick up the residue (remnants) from previously recorded data even though the area has been rewritten.

This is not a simple procedure; however, it is employed if the <u>missing information</u> is related to national defense or some other critical situation

7 0
3 years ago
What is the output of this program ? Assume the user enters 3,6 and 11​
Nostrana [21]

Answer:

C++

Explanation:

C++ Standards

C++ is standardized as ISO/IEC 14882. Currently, there are two versions:

C++98 (ISO/IEC 14882:1998): First standard version of C++.

C++03 (ISO/IEC 14882:2003): minor "bug-fix" to C++98 with no change to the language. Commonly refer to as C++98/C++03 or First C++ standard.

C++11 (ISO/IEC 14882:2011): Second standard version of C++. Informally called C++0x, as it was expected to finalize in 200x but was not released until 2011. It adds some new features to the language; more significantly, it greatly extends the C++ standard library and standard template library (STL).

C++14: Infomally called C++1y, is a small extension to C++11, with bug fixes and small improvement.

C++17: informally called C++1z.

C++2a: the next planned standard in 2020.

C++ Features

C++ is C. C++ supports (almost) all the features of C. Like C, C++ allows programmers to manage the memory directly, so as to develop efficient programs.

C++ is OO. C++ enhances the procedural-oriented C language with the object-oriented extension. The OO extension facilitates design, reuse and maintenance for complex software.

Template C++. C++ introduces generic programming, via the so-called template. You can apply the same algorithm to different data types.

STL. C++ provides a huge set of reusable standard libraries, in particular, the Standard Template Library (STL).

C++ Strength and Pitfall

C++ is a powerful language for high-performance applications, including writing operating systems and their subsystems, games and animation. C++ is also a complex and difficult programming language, which is really not meant for dummies. For example, to effectively use the C++ Standard Template Library (STL), you need to understand these difficult concepts: pointers, references, operator overloading and template, on top of the object-oriented programming concepts such as classes and objects, inheritance and polymorphism; and the traditional constructs such as decision and loop. C++ is performance centric. The C++ compiler does not issue warning/error message for many obvious programming mistakes, undefined and unspecified behaviors, such as array index out of range, using an uninitialized variable, etc, due to the focus on performance and efficiency rather than the ease of use - it assumes that those who choose to program in C++ are not dummies.

6 0
3 years ago
. Write at least three benefits of using a network.​
Annette [7]

Answer:

Advance your career

Gain more knowledge

And have another way to talk to your friends especially during the pandemic

3 0
3 years ago
Other questions:
  • Email applications can either be local email client programs or web-based applications. Which application is an example of a loc
    13·2 answers
  • tion. 6. A step occasionally required to repair damaged relationships is O A. looking at the problem from the other person's poi
    14·1 answer
  • Windows Server 2012 R2 provides hardware-independent NIC teaming or bonding to allow for better network performance and adapter
    6·1 answer
  • is there anybody out there who is a social butterfly like me? If so then you can tlk to me on this. and to anybody out there tha
    12·1 answer
  • viewRatings(string, int) Takes a username and a minimum rating value. It prints all the books that the user has rated with a val
    10·1 answer
  • What is another name for repetition in programming?
    11·1 answer
  • Can anyone please help?
    13·1 answer
  • Who is considered as the father of computer science?​
    11·1 answer
  • You can enter common data in multiple worksheets by __________.
    14·2 answers
  • Tools used to build a bridge<br>​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!