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
goblinko [34]
3 years ago
13

Assume that the array monthSales of integers has already been declared and that its elements contain sales data for the 12 month

s of the year in order (i.e., January, February, etc.). Write a statement that writes to standard output the element corresponding to October. Do not write anything else out to standard output.
Computers and Technology
1 answer:
bonufazy [111]3 years ago
6 0

Answer:

The c++ statement to display the sale corresponding to the month of October is given below.

cout << monthSales[9];

Explanation:

The integer array monthSales contains data for 12 months beginning from January to December, in the order in which the months appear.

January sales is represented by index 0 while December sales is given by index 11.

Hence, the index of the array is one less than the numerical value of the month.

The sales value corresponding to October, the tenth month, is given by index 9, monthSales[9].  

Only the sales for October is displayed as per the question. Nothing else is displayed.

The c++ program to implement the above statement is given below.

#include <iostream>

using namespace std;

int main() {

   // array containing sales data for 12 months

   int monthSales[12];

monthSales[12] = { 1234, 2345, 3456, 4567, 5678, 6789, 7890, 8901, 9012, 1208, 1357, 2470 };

       // only sales data corresponding to month of October is displayed  

   // nothing else is displayed

   cout << monthSales[9];

return 0;    

}

OUTPUT

1208

First, the array is declared.

   int monthSales[12];

The keyword int represents the integer data type of the array.

The number 12 indicates the length of the array. The array will contain 12 values.

The index of the last element will be 12 – 1 = 11.

This is followed by initialization with twelve numerical values.

monthSales[12] = { 1234, 2345, 3456, 4567, 5678, 6789, 7890, 8901, 9012, 1208, 1357, 2470 };

Only the value for October needs to be displayed. This is achieved by the below statement.

   cout << monthSales[9];

The cout keyword is used to display to the standard output.  

No new line character is inserted. No message is displayed.

The sales data can be modified. Only integer values should be taken. Floating or double values will not compile and an error will be displayed.

You might be interested in
A friend is having a problem with keeping a fish tank at the right temperature so the fish stay healthy. Describe how you could
omeli [17]

Answer:

water temperature gauge sensor

Explanation:

  • We can connect a temperature sensor connected to the water and a heater or cooler sensor, we have created a program to check the temperature from the sensor.
  • when the water is hotter than recommended, we turn on the refrigerator and when it is cold, we turn on the heater
  • so correct answer is water temperature gauge sensor

4 0
3 years ago
Look at the code below. What does it do?
yulyashka [42]

Answer:

3- The code takes in an input, turns it into an integer and then multiplies it by 2 and prints it

Explanation:

Look- First, the code snippet asks for an input (int or float) as "Rawheight".

Aftewards, it converts the input into an integer numeral(if it was a float) and multiplies it by 2.

This processed value is, then, further transferred to the variable "double_height" and is thereafter rendered on the user's virtual screen.

5 0
2 years ago
Driving at slower speeds than traffic flow _____________ .
UNO [17]
The answer is B. may impede other vehicles on the road that are traveling at a normal and safe speeds
4 0
3 years ago
What should you always do to clean off tables
ikadub [295]
Wipe then off then spray them down then wipe off again
7 0
3 years ago
Read 2 more answers
Which camera does Angelina use?
julia-pushkina [17]

Answer:

mirrorless cameras have lot more space due to not having mirrors. and they have the same or better quality than DSLR's.

8 0
3 years ago
Other questions:
  • What are an administrator's choices for managing file permissions on a drive formatted as fat32?
    10·1 answer
  • The code segment below uses the procedure IsPartOf (list, item), which returns true if item appears in list and returns false ot
    13·1 answer
  • Leonardo is having difficulty accessing the course website. he should contact the for assistance. (points:1)
    13·1 answer
  • Strengths and weaknesses about esport
    10·1 answer
  • How did imperialism lead to WWI? A The debate of the morality of imperialism created tensions around Europe b Native people were
    12·1 answer
  • Is the most important characteristic of a hard drive.​
    7·2 answers
  • Match the hardware device with the "category" into which it falls. Remember to choose
    8·1 answer
  • Read the ages of three people and find the average. Display the result.
    10·1 answer
  • The users, groups, and roles that have access to a server are called ______________________________.
    15·1 answer
  • Please help with this question
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!