Explore BrainMass
Share

An easy to understand example of arithmetic in C++

This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

Write a c++ program.

1. As a part time student and a part time worker, you earn $4.50 an hour. Your parents will buy you a used car, but you must pay for the gas. gas costs $1.10/gallon and you use 20 gallons/week. How many hours will you work each week to pay for the gas to fuel your car?

© BrainMass Inc. brainmass.com March 21, 2019, 4:56 pm ad1c9bdddf
https://brainmass.com/computer-science/cpp/easy-understand-example-arithmetic-203493

Solution Preview

This problem requires declaring some variables and setting their values based on a couple of arithmetic expressions. To make things easier to read we start by declaring variables for the known data:

double ...

Solution Summary

This solution shows a simple C++ program that performs a basic arithmetic expression. The explanation of the program is very detailed and clearly shows what each statement in the program is doing. This is very illustrative for C++ beginners who are trying to get enough information to "get started".

$2.19