|
|
|
|
|
|
|
Get One Amount (Out: amount) Level 2 |
|
|
|
|
|
|
|
|
DO
Read amount
IF amount <0.0
Print error message
WHILE amount <0.0 |
|
|
|
|
|
|
|
|
|
//******************************************************************
// Rainfall program
// This program inputs 12 monthly rainfall amounts from a
// recording site and computes the average monthly rainfall.
// This process is repeated for as many recording sites as
// the user wishes.
//******************************************************************
#include <iostream.h>
#include <iomanip.h> // For setprecision()
void Get12Amounts( float& );
void GetOneAmount( float& );
void GetYesOrNo( char& );
int main()
{
float sum; // Sum of 12 rainfall amounts
char response; // User response (y or n)
cout.setf(ios::fixed, ios::floatfield); // Set up floating pt.
cout.setf(ios::showpoint); // output format
cout << setprecision(2);
|
|
|
|
|
|