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
IrinaK [193]
2 years ago
11

cout << "Part 1" << endl; // Part 1 // Enter the statement to print the numbers in index 4 and index 9 // put a spac

e in between the two numbers cout << endl; // Enter the statement to print the numbers 3 and 80 from the array above // put a space in between the two numbers cout << endl; // Enter the statement to change the number 1 in the array to be 12 // then write the statement to print out that number in the array cout << "\nPart 2" << endl; // Part 2 // Write a function called printAll. It takes in an array // and an integer that has the number of values in the array. // The function should print all the numbers in the array with // a space between each one. // Call the function on the line below. cout << "\nPart 3" << endl; // Part 3 // Write a function called printEven. It takes in an array and // an integer that has the number of values in the array. It prints // all the even numbers in the array with a space between each one. // This function returns the count of evens. int evens; // Call the function you just wrote and store the // answer in the variable evens declared above.
Computers and Technology
1 answer:
Margarita [4]2 years ago
3 0

Answer and Explanation:

#include <iostream>

using namespace std;

int printEven(int array[],int n)

{

int count=0;

for(int i=0;i<n;i++)

{

if(array[i]%2==0)

{

count++;

cout<<array[i]<<" ";

}

}

return count;

}

void printAll(int array[],int n)

{

for(int i=0;i<n;i++)

{

cout<<array[i]<<" ";

}

}

int computeTotalOdds(int array[],int n)

{

int count=0;

for(int i=0;i<n;i++)

{

if(array[i]%2!=0)

{

count++;

 

}

}

return count;

}

int main()

{

int array1[20] = {3, 18, 1, 25, 4, 7, 30, 9, 80, 16, 17};

int numElements = 11;

cout << "Part 1" << endl;

cout<<array1[4]<<" "<<array1[9];

cout << endl;

cout<<array1[0]<<" "<<array1[8];

cout << endl;

array1[2]=12;

cout << "\nPart 2" << endl;

printAll(array1,numElements);

 

cout << "\nPart 3" << endl;

int evens;

evens=printEven(array1,numElements);

 

 

 

 

// This will print the number of evens in the array.

cout << endl << evens;

 

cout << "\nPart 4" << endl;

 

int total;

 

total=computeTotalOdds(array1,numElements);

cout << endl << total;

 

return 0;

}

You might be interested in
Help pls<br> cmu cs 0<br> 4.1.2.1 Creating Groups checkpoint 1
Sindrei [870]

Answer:

Explanation:

Circle(centerX, centerY, radius, fill='black', border=None,

borderWidth=2, opacity=100, rotateAngle=0, dashes=False,

align='center', visible=True)

8 0
2 years ago
Read 2 more answers
For questions 3-6, consider the following two-dimensional array:
elena-s [515]

Answer:

5= Fabric

6=bandana

Explanation:

8 0
3 years ago
Read 2 more answers
Design a flowchart or pseudocode for a program that accepts three numbers from a user and displays a message if the sum of any t
Keith_Richards [23]

Answer:

Hi there! Pseudocode is the process of writing out the high-level structure of the program in simple English terms which acts as a blueprint of how the program will work. The pseudocode for this question is written below.

Explanation:

Prompt user for input 1

Validate input 1

Prompt user for input 2

Validate input 2

Prompt user for input 3

Validate input 3

Perform checks:

If  

 1 and 2 equals 3

 Or

 1 and 3 equals 2

 Or

 2 and 3 equals 1

Display message to user

6 0
2 years ago
What are the two access modes that are used when opening a file for input and output when pickling?
san4es73 [151]

The two access modes that are used when opening a file for input and output when pickling are rb and wb.

<h3>What is pickling?</h3>

Pickle is generally used in Python to serialize and deserialize a Python object structure. In other words, it is the act of transforming a Python object into a byte stream in order to save it to a file/database, maintain program state across sessions, or transport data over a network. By unpickling the pickled byte stream, the original object hierarchy can be recreated. This entire procedure is comparable to object serialization in Java or .Net.

When a byte stream is unpickled, the pickle module first makes an instance of the original object before populating it with the right data. To accomplish this, the byte stream only carries data relevant to the original object instance.

To learn more about python visit:

brainly.com/question/13437928

#SPJ4

8 0
1 year ago
The elements of an integer-valued array can be set to 0 (i.e., the array can be cleared) recursively as follows: An array of siz
marta [7]

Answer:.......

void clear(int *array, int length){

 

  if (length == 0)return;  

 

  array[0] = 0;  

 

  clear(array + 1, length-1);

}

Explanation:

The void function accepts an integer array.

7 0
3 years ago
Other questions:
  • Identify at least three body language messages that project a positive attitude?
    15·1 answer
  • The term "Cloud" refers to what option(s) below? (Select all that apply)
    13·1 answer
  • You are tasked with leading a project to build a custom software testing tool for client. You have been provided with a set of p
    7·1 answer
  • A(n) _____ is a firm that delivers a software application, or access to an application, by charging a usage or subscription fee.
    6·1 answer
  • Unwanted email sent to large groups of people who did not request the communication is called _____
    12·1 answer
  • What does this function do in the code?
    5·2 answers
  • Help plz, u just gotta select all that apply :)
    15·1 answer
  • The specific instructions that a computing device needs to boot up and control the hardware
    12·1 answer
  • Most scheduling algorithms maintain a run queue, which lists processes eligible to run on a processor. On multicore systems, the
    10·1 answer
  • The rectangular symbol in flowchart<br> is used to denote dash
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!