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
Type the correct answer in the box.
qwelly [4]

Answer:

I think the answer you're looking for is "personal gain"

Hope this helped :D

Explanation:

8 0
3 years ago
Which business application uses location information to provide a service and is designed to give mobile users instant access to
statuscvo [17]

Answer:

The correct answer to the following question will be "Location-based services".

Explanation:

Location-based services are resources that are delivered via a cell phone to take into consideration the geographical location of just the user. It usually include entertainment or data.

  • This uses the technology of GPS from a smartphone to detect the location or the position of an individual if that individual has expressed a preference-in to enable the service to do just that.
  • The app will classify its search down to a physical address during a smartphone user chooses-in, without any need for automatic input of the data.

Therefore, it's the right answer.

3 0
3 years ago
On her last performance review, beverly's boss commented that she needs to help out her co-workers when they are busy in order t
labwork [276]
Inter personal. As she needs to work with persons, them being her co workers
4 0
4 years ago
Read 2 more answers
Match the metric units with these measurements
zavuch27 [327]
Force:newtons
distance:meters
work:joules
power:either watts or horsepower
energy:joules
time:kiloseconds and milliseconds
6 0
3 years ago
The MIQ inventory measures how much you value status. What are measures of status?
Alina [70]
When we're taking about measures of status, we're talking about either a socioeconomic perspective or something else. When we're talking about a socioeconomic perspective of status, there are two important measures. One would be social standing of a person and the other would be his economic standing. 
3 0
4 years ago
Other questions:
  • Which of the following is not a good way to conserve fuel and reduce emissions?
    13·2 answers
  • Which topology enables only one person, at one time, to send data to others on the network?
    6·1 answer
  • What is the prediction in technology for the future?
    6·1 answer
  • Explain the four basic operation performed by every computer​
    11·2 answers
  • Hurry answerrrrrrr pleaseee
    11·2 answers
  • Please help! i need to answer this soon!
    13·1 answer
  • What is the alogarithm for solving the perimeter of a triangle
    11·1 answer
  • First computer to use Windows os?​
    5·1 answer
  • Which phrases in the passage provide clues that trifling means "silliness” or "insignificance”? Check all that apply.
    12·1 answer
  • Will Give Brainiest to the first correct answer!!!!
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!