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
What are minimum computer requirements for a software program?
Bumek [7]
<span><span>Operating system: Windows 2000/XP
</span><span>CPU: Pentium 4 1.5 GHz or Athlon XP 1500+ processor or higher
</span><span>Memory: 384 MB RAM</span></span>
8 0
3 years ago
The systems development life cycle (SDLC) is the overall process of developing, implementing, and retiring information systems t
MissTica

Answer:

the system development life cycle (SDLC) is the overall process of developing, implementing, and retiring information systems through a multistep process—initiation, analysis, design, implementation, and <u>maintenance to disposal.</u>

Explanation:

There are several  SDLC models and each generally consists of a numbers of definite stages. For a given adopted SDLC model, information security and product services must be integrated in to the SDLC to ensure appropriate protection for the information that the system will transmit, process, and store.

8 0
3 years ago
UPS or FedEx plays what role in the supply?
nikdorinn [45]

Explanation:

the answer in the image above

8 0
2 years ago
A seven-octet pattern of alternating 0s and 1s used by the receiver to establish bit synchronization is a _______
Licemer1 [7]

Answer: Preamble

Explanation:

 Preamble is a 7- octet pattern of alternating the 0's and 1's and it allow devices in the network to easily synchronized the receiver clock. It also provide the bit level synchronization.

It basically allow the start of frame delimiter to provide the byte synchronization and assign a new frame. The bits are transmit orderly from left to right in the frame.  

5 0
3 years ago
The border that defines the outer boundary of a shape or other object
Over [174]
The answer is outline
8 0
3 years ago
Other questions:
  • A(n) ____________________ is a set of programs that coordinates all the activities among computer or mobile device hardware.
    10·1 answer
  • Wide area network (WAN) connects multiple networks that are in the same geographical locations.
    6·1 answer
  • What type of Internet monitoring technique records information about a customer during a web surfing session, such as what websi
    8·1 answer
  • What major criteria must a product or process meet in order to be considered emerging technology?
    7·1 answer
  • What is the first step to apply the line and page breaks options to groups of paragraphs in a Word document?
    10·2 answers
  • Write a program that ask the user to enter air water or Steele and the distance that a sound wave will travel in the medium the
    9·1 answer
  • Claire wants to use a conditional statement in JavaScript that provides a block of statement to be executed if the condition is
    7·2 answers
  • What are Database administrators? <br> Thank you :)
    7·1 answer
  • In what ways are super computer different from mainframe computers.​
    10·1 answer
  • 30 POINTS FOR THE ANSWER
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!