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
vesna_86 [32]
3 years ago
12

Write three statements to print the first three elements of array runTimes. Follow each statement with a newline. Ex: If runTime

= {800, 775, 790, 805, 808}, print:
800
775
790
Note: These activities will test the code with different test values. This activity will perform two tests, both with a 5-element array (int runTimes[5]). See "How to Use zyBooks".
Also note: If the submitted code tries to access an invalid array element, such as runTime[9] for a 5-element array, the test may generate strange results. Or the test may crash and report "Program end never reached", in which case the system doesn't print the test case that caused the reported message.
#include
using namespace std;
int main() {
const int NUM_ELEMENTS = 5;
int runTimes[NUM_ELEMENTS];
int i;
for (i = 0; i < NUM_ELEMENTS; ++i) {
cin >> runTimes[i];
}
/* Your solution goes here */
return 0;
}
Please help me with this problem using c++.

Computers and Technology
1 answer:
yawa3891 [41]3 years ago
8 0

Answer:

Following are the code to this question:

for (i = 0; i <3; ++i)//defining loop to print value

{

cout<<runTimes[i]<<endl;//print value

}

Explanation:

Full program code to this question:

#include<iostream>//defining header file

using namespace std;

int main() //defining main method

{

const int NUM_ELEMENTS = 5;//defining const integer variable

int runTimes[NUM_ELEMENTS]; //defining integer array

int i;//defining integer variable

for (i = 0; i < NUM_ELEMENTS; ++i)//defining loop to input value

{

cin >> runTimes[i];//input value  

}

cout<<"print three elements value of array: "<<endl;

for (i = 0; i <3; ++i)//defining loop to print value

{

cout<<runTimes[i]<<endl;//print value

}

return 0;

}

Output:

Please find the attachment.

Description:

  • In the above code, an integer const variable "NUM_ELEMENTS" is declared, that assign value "5" which is array size, in the next step, an array "runTimes" is declared.
  • In the next step, for loop is used, that uses an integer variable "i", which is used to input all array elements.
  • In the next line, another for loop is used, which uses "i" variable, which starts from 0 and ends when its value less than 3, inside the loop print method, used that prints 3 array elements.  

You might be interested in
How ICT has helped education to grow through progression?
Vsevolod [243]

Answer:

Hey there!

Explanation:

This is ur answer...

<em>ICTs can enhance the quality of education in several ways: by increasing learner motivation and engagement, by facilitating the acquisition of basic skills, and by enhancing teacher training. ICTs are also transformational tools which, when used appropriately, can promote the shift to a learner-centered </em><em>environment.</em>

Hope it helps!

Brainliest pls!

Have a good day!^^

6 0
2 years ago
Write code to complete doublePennies()'s base case. Sample output for below program with inputs 1 and 10: Number of pennies afte
UkoKoshka [18]

Answer:

public class CalculatePennies {

// Returns number of pennies if pennies are doubled numDays times

  public static long doublePennies(long numPennies, int numDays) {

     long totalPennies = 0;

     /* Your solution goes here */

     if(numDays == 0){

         totalPennies = numPennies;

     }

     else {

        totalPennies = doublePennies((numPennies * 2), numDays - 1);

     }

     return totalPennies;

  }

// Program computes pennies if you have 1 penny today,

// 2 pennies after one day, 4 after two days, and so on

  public static void main (String [] args) {

     long startingPennies = 0;

     int userDays = 0;

     startingPennies = 1;

     userDays = 10;

     System.out.println("Number of pennies after " + userDays + " days: "

          + doublePennies(startingPennies, userDays));

     return;

  }

}

Explanation:

8 0
3 years ago
In the metric system, fluid flow is measured in cubic meters per second (m3/s). a cubic foot per second (ft3/s) is equivalent to
vivado [14]

Here you go,


flowrate.m

cbps = input('Enter the flow in m^3/sec: ');

cfps = cbps ./ 0.028;

fprintf('A flow rate of %.3f meters per sec\n', cbps);

fprintf('is equivalent to %.3f feet per sec\n', cfps);

3 0
3 years ago
I need this ASAP!
Elanso [62]

Answer:

b

Explanation:

4 0
3 years ago
Read 2 more answers
The K-Means algorithm terminates when:_______
gavmur [86]

Answer:

b. the cluster centers for the current iteration are identical to the cluster centers for the previous iteration.

Explanation:

K-mean algorithm is one of the mot widely used algorithm for partitioning into groups of k clusters. This is done by partitioning observations into clusters which are similar to each other. When using k-mean algorithm, each of the different clusters are represented by their centroid and each point are placed only in clusters in which the point is close to cluster centroid.

The K-Means algorithm terminates when the cluster centers for the current iteration are identical to the cluster centers for the previous iteration.

7 0
3 years ago
Other questions:
  • If you have a database with birthdates, and you would like to find everyone who was born before June 16, 1967, what would you en
    15·2 answers
  • What kind of heat we feel from the sun
    15·2 answers
  • What is meant by ‘LASER’?
    8·2 answers
  • What property do we use to distinguish a specific element from a form? value name click this
    12·1 answer
  • What outline feature can the Navigation pane browse the document by?
    14·2 answers
  • What is "the last mile of broadband access"? Why is this a problem and what kind of impact does it have on the business world an
    9·1 answer
  • Which of the following will increase the level of security for personal information on a mobile device if the device is lost or
    7·2 answers
  • What is one advantage and disadvantage of designing a support security that might be based on a centralized model, where all sen
    11·1 answer
  • Do OBS mic filters apply everywhere? Such as discord and other apps similar. Or is it just on streaming?
    15·1 answer
  • Hisoka is creating a summary document for new employees about their options for different mobile devices. One part of his report
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!