# a8.cpp - /courseID CIS165-006HY/name Marlen Herrera/Prof...

• Homework Help
• 2

This preview shows page 1 - 2 out of 2 pages.

//courseID: CIS165-006HY //name: Marlen Herrera //Prof. Wang //Assignment #8 //Due by 11/16/2017 /* steps 1.Input: a.mph b.time c.distance d.maxTime 2.Processing: a.distance = mph * time b.++time c.time <maxTime 3.Output: a."How fast is the vehicle going? Please enter speed in miles per hour." b."How many hours has the vehicle traveled?" c."Hour Distance Traveled" d."Error. You cannot have a negative number for speed. Please enter a positive number for speed." e."Error. Your time traveled cannot be less than 1 hour. Please input time." */ #include <iostream> using namespace std; int main() { int mph = 0, time = 1, minTime = 1, maxTime = 0, distance = 0; //Output that asks the user for speed information. cout << "How fast is the vehicle going? Please enter speed in miles per hour.\n"; //Input from user about speed. cin >> mph; //Loop helps validate data. In this case stops user from sending negative

Subscribe to view the full document.

• Spring '15
• Wang, Negative and non-negative numbers, Marlen Herrera

{[ snackBarMessage ]}

###### "Before using Course Hero my grade was at 78%. By the end of the semester my grade was at 90%. I could not have done it without all the class material I found."
— Christopher R., University of Rhode Island '15, Course Hero Intern

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern