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
Open this link after reading about Ana's situation. Complete each sentence using the drop-downs. Ana would need a minimum of ato
Arte-miy333 [17]

bachelor degree and grow

6 0
3 years ago
Read 2 more answers
When an object is falling because of gravity, the following formulacan be used to determine the distance the object falls in asp
ser-zykov [4K]

Answer:

True

Explanation:

When an object is falling under the influence of gravity, the distance of fall as a function of time is given by:

D(t)=ut + 1/2 * a * t^2

Where

u = initial velocity of the object ( = 0 in this case as the object is falling only under gravity),

a = acceleration of the falling object = g = 9.8 m/s^2 which represents the acceleration due to gravity.

Simplifying,

D(t) = 1/2 * g * t^2

6 0
3 years ago
Can computers be opened from the All programs submenu
Bad White [126]

Answer:

I am pretty sure...if not try duck duck go

8 0
1 year ago
8. When requesting a review of a denied claim, it is required to send a _______________ with the claim.
liq [111]
I'd say an appeal letter.

An appeal letter should be sent with the claim to request for review of an insurance claim that has been denied or underpaid by an insurance company. An appeal is important because it lets the insurance company know that you disagree with the decisions they have issued



4 0
3 years ago
A colleague sent you an awesome article about using proper ergonomics while sitting at the computer. You don't have time to read
lys-0071 [83]

Answer: Select the article attachment and save it to your computer.

Explanation:

5 0
2 years ago
Other questions:
  • Bitnet, one of the predecessors of the internet was launched in 1981. what does bitnet stand for?
    12·1 answer
  • Among the many DTP software tools available today, which is regarded as the industry standard for DTP?
    13·2 answers
  • What specific type of DNS query instructs a DNS server to process the query until the server replies with an address that satisf
    13·1 answer
  • If the ____________ is broken on a laptop, chances are other parts are also broken.
    12·1 answer
  • What is the difference between a Is your Milling machine and grinding machine
    6·1 answer
  • Insufficient vacuum will require the driver to _______________ to adequately activate the brakes?
    13·1 answer
  • FREEFREEFREEFREEFREEFREE
    11·2 answers
  • What describes a group of cells?<br> O crowd<br> Orange<br> O set<br> gangle
    7·2 answers
  • What were the important developments that occurred in photography that facilitated the creation of motion pictures? Two critical
    6·1 answer
  • Based on the description below which website is more appropriate
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!