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
BigorU [14]
3 years ago
10

Write a program that declares three one-dimensional arraysnamed miles, gallons, and mpg. Each array should be declared in main()

and should becapable of holding ten double-precision numbers. The numbers that should be stored in miles are240.5, 300, 189.6, 310.6, 280.7, 206.9, 199.4, 160.3, 177.4, and 192.3. The numbers should bestored in gallons are 10.3, 15.6, 8.7, 14, 16.3, 15.7, 14.9, 10.7, 8.3, and 8.4.
Computers and Technology
1 answer:
Helen [10]3 years ago
4 0

Answer:

#include <iostream>

using namespace std;

int main(){

   double miles[10] = {240.5, 300, 189.6, 310.6, 280.7, 206.9, 199.4, 160.3, 177.4, 192.3};

   double gallons[10] = {10.3, 15.6, 8.7, 14, 16.3, 15.7, 14.9, 10.7, 8.3, 8.4};

   double mpg[10];

   for (int i = 0; i < 10; i++){

       mpg[i] = miles[i]/ gallons[i];

       cout << "mpg: " << mpg[i] << endl;

   }

}

Explanation:

The C++ source code declares three arrays miles, gallons and mpg with an array length of 10. The gallons and miles arrays are assigned 10 array items each and they are used to push values to the mpg array in the for loop statement. The result of each item in the mpg array is displayed on the screen.

You might be interested in
Write a full class definition for a class named Counter, and containing the following members: A data member counter of type int
vfiekz [6]

// making the class

class Counter {

int counter;

int limit;

// Constructor

Counter(int a, int b){

counter = a;

limit = b;

}

// static function to increment

static increment(){

if(counter<limit)

nCounter+=1;

}

// Decrement function

void decrement(){

if(counter>0)

nCounter-=1;

}

int getValue(){

return counter;

}

static int nCounter;

int getNCounters(){

return nCounter;

}

};

// Initializa the static

int Counter::nCounter = 0;

4 0
3 years ago
Objectives ** WILL GIVE BRAINIST PLEASE**
mamaluj [8]

Answer:

of which std this question is

8 0
2 years ago
Read 2 more answers
What is another name for maize?
Oliga [24]
Hunted house? maize is what I call the haunted houses from knots spray farm or universal studios
5 0
3 years ago
Program _______ graphically present the detailed sequence of steps needed to solve a programming problem.
AlekseyPX

Program Pseudocode graphically present the detailed sequence of steps needed to solve a programming problem.

<h3>What are Pseudocode?</h3>

These are known to be a set of codes that a program has graphically depicted all of its sequence of steps that can be sued to handle a programming problem.

Note that Pseudocode is a form of artificial and man made informal language that is often used by programmers to create  algorithms.

Learn more about Program from

brainly.com/question/153827

#SPJ1

3 0
2 years ago
6. Assume a processor supports all instructions and addressing modes. A program consists of 25% store words, 15% load words, 10%
Sloan [31]

Answer:

After checking the attached picture, come to this calculated "Total Time".

Total time 'T'

T = (0.25)(200) + (0.15)(200) + (0.1)(250) + (0.05)(175) + (0.45)(75)

T = 147.5 ps

8 0
3 years ago
Other questions:
  • Tom's using Google Ads to promote his bicycle store. He's created an Android App and needs to measure how effectively the curren
    14·1 answer
  • What is a gutter margin?
    5·2 answers
  • How to make a cartoon can we use adobe flash
    7·2 answers
  • The ability of services to grow or shrink based on need is called __________.
    14·1 answer
  • How would you display all your photographic work in your résumé, if you have a large volume of work?
    10·1 answer
  • Software that protects confidentiality by screening outgoing documents to identify and block transmission of sensitive informati
    12·1 answer
  • 1. cybersquatting refers to the tampering of existing web sites and selling unrelated products (true or false)
    8·1 answer
  • Use the drop-down menus to describe how Adnan can add shapes to his presentation.
    11·1 answer
  • Literally no one helps answer my questions so this website is pointless.... : /
    11·1 answer
  • What describes Accenture's approach to automation?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!