CS 1440 pre-lab activities for Lab 2

Before coming to the lab you should read through page 83 in our text, then answer in writing the following question:

1. On a piece of paper, write or type a C++ program that asks users to input the number of dollars and cents separately as two integers and display the result as $dollars.cents when both the dollars and cents are positive values.  If either one is negative, just display that one of them was negative and terminate the program.  For now, assume that users will not enter any cents larger than 99.  Later we will take care of this.

Example of input/output:
Enter the dollars: 23
Enter the cents: 50
Your money was: $23.50

Example of input/output
Enter the dollars: -12
Enter the cents: 50
Sorry, one of the dollars or cents values was negative.

2. What is the difference between these two program segments?
 
Segment 1:
double x;
cin >> x;
if(x<5)cout << "less";
if(x>5)cout << "more";
Segment 2:
double x;
cin >> x;
if(x<5)cout << "less";
else cout << "more";

Turn in your answer at the start of the lab.