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
Which data type is -7
bixtya [17]

Answer:

integer

Explanation:

4 0
3 years ago
If you have questions about taxes, where can you go to get answers?
Andrews [41]

Answer:

Explanation:

i was told to paste this to other comment sections sooo...HEY PLS DON'T JOIN THE ZOOM CALL OF A PERSON WHO'S ID IS 825 338 1513 (I'M NOT SAYING THE PASSWORD) HE IS A CHILD PREDATOR AND A PERV. HE HAS LOTS OF ACCOUNTS ON BRAINLY BUT HIS ZOOM NAME IS MYSTERIOUS MEN.. HE ASKS FOR GIRLS TO SHOW THEIR BODIES AND -------- PLEASE REPORT HIM IF YOU SEE A QUESTION LIKE THAT. WE NEED TO TAKE HIM DOWN!!! PLS COPY AND PASTE THIS TO OTHER COMMENT SECTIONS

4 0
2 years ago
Which of the following is not a characteristic of a large database?
BartSMP [9]
C is the correct answer
8 0
3 years ago
which of the following is not a driver of wireless growth? group of answer choices universal access to information and applicati
AysviL [449]

The invention of the micro hard drive is not a driver of wireless growth.

What is Hard Drive (HDD)?

A computer hard drive (also known as a hard disk or HDD) is a type of technology that stores your computer's operating system, applications, and data files such as documents, pictures, and music. The rest of your computer's components work together to display the applications and files stored on ones hard drive.

How does a Hard Drive (HDD) work?

A hard disk drive (HDD) is made up of a platter with data storage compartments. This information includes your operating system, applications, and any files that you have created. There's also an accuator arm that keeps moving across the platter to read or write the data. The platter spins as the accuator arm movements across it to speed up the process.

To learn more about Hard Drive (HDD), visit: brainly.com/question/27269845

#SPJ4

6 0
1 year ago
Why are duplicate tuples not allowed in a relation?
velikii [3]

Answer:

Explanation:

Duplicate tuples are not allowed in a relation because the specifications of the constraints of the regional integrity are violated, especially the main constraint that states that there can be no identical values for the attributes of two tuples at any database relation state.

Also, duplicate tuples are not allowed in a relation due to the fact that they lead to redundancy of the data base which in turn, slowing down the speed of the database when data processing such as inserting, querying, updating, deleting, etc are being performed.

4 0
3 years ago
Other questions:
  • Your company is developing a new marketing campaign and wants to know which customers have never placed an order. You will need
    10·1 answer
  • The Freemont Automobile Factory has discovered that the longer a worker has been on the job, the more parts the worker can produ
    11·1 answer
  • What is the difference between primary storage,secondary storage and offline storage what type of storage can be
    6·2 answers
  • When is e-mail an appropriate channel for goodwill messages? If you frequently communicate with the receiver by e-mail and are c
    15·1 answer
  • What do character formats do for your document's message??
    14·2 answers
  • The memory unit of a computer has 2M Words of 32 bits (or 4 bytes) each. The computer has an instruction format with 4 fields: a
    14·1 answer
  • In a Microsoft Office application, what is the area at the bottom of the application screen that contains information about the
    13·1 answer
  • Add Try/Catch error checking To make sure that the user enters valid values in your program. To catch negative values passed to
    9·1 answer
  • A wireless ________ extender is a network device that enhances transmission of your wireless signal.
    11·1 answer
  • What are the major benefits of preproduction?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!