X hits on this document

42 views

0 shares

0 downloads

0 comments

14 / 15

Appendix C:

// This program computes the distance, time, and rate

// of air pollution from APS (Arizona Public Service) power plant.

  • #

    include <iostream> //For std::cin, std::cout, and std::endl

using namespace std; //Allow use of cout, cin, endl, and string

int main ()

{

// A. Intialize objects

double t = 0.0;

// t = TIME

double r = 0.0;

// r = RATE

double d = 0.0;

// d = DISTANCE

//B. Input

cout << “Enter a number for time : ” << endl;

cin >> t;

cout << “Enter a number for rate : ” << endl;

cin >> r;

//C. Process

d = (t * r ) * 0.01

// distance = time * rate * 0.01 (for decimal reason)

//D. Output

cout << “The distance pollution traveled in ” << t << “minutes at

a rate of ” << r << “MPH is ” << d << “miles.”;

14

Document info
Document views42
Page views42
Page last viewedSat Dec 10 17:31:16 UTC 2016
Pages15
Paragraphs237
Words1514

Comments