I still have the same error messages even after fixing it. My reverse IPO comes out right though...Everything seems to work just fine..except for those error messages:
In function `int main()':
[Warning] converting to `int' from `double'
Do I just ignore them or what?
Current code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
// Headers and Other Technical Items
#include <iostream>
using namespace std;
// Function Prototypes
void pause(void);
// Variables
double length;
double width;
double height;
double price_gal_paint;
int coverage_gal_paint;
double total_area;
int total_gal_paint;
double total_cost;
//******************************************************
// main
//******************************************************
int main(void)
{
// Input
cout << "\nEnter the length of the house --->: ";
cin >> length;
cout << "\nEnter the width of the house --->: ";
cin >> width;
cout << "\nEnter the height of the house --->: ";
cin >> height;
cout << "\nEnter the price of a gallon of paint--->: ";
cin >> price_gal_paint;
cout << "\nEnter the square feet coverage of a gallon of paint --->: ";
cin >> coverage_gal_paint;
// Process
(double) (total_area = length * height * 2 + width * height * 2);
(int) (total_gal_paint = total_area / coverage_gal_paint + 0.9999);
(double) (total_cost = total_gal_paint * price_gal_paint);
//Output
cout << "\nThe gallons of paint needed is -------->: ";
cout << total_gal_paint;
cout << "\nThe total cost is -------->: ";
cout << total_cost;
pause();
return 0;
}
//******************************************************
// pause
//******************************************************
void pause(void)
{
cout << "\n\n";
system("PAUSE");
cout << "\n\n";
return;
}
//******************************************************
// End of Program
//******************************************************
|
The pseudocode was given to me:
input
display a message asking user for the length of the house
get the length of the house from the keyboard
display a message asking user for the width of the house
get the width of the house from the keyboard
display a message asking user for the height of the house
get the height of the house from the keyboard
display a message asking user for the price of a gallon of paint
get the price of a gallon of paint from the keyboard
display a message asking user for the sq ft coverage of a gallon of paint
get the sq ft coverate of a gallon of paint from the keyboard
processing
calculate the total area of the building by:
1) multiplying the length by height by 2;
2) then multiply the width by height by 2;
3) then add the two results together
calculate the number of gallons of paint needed by:
1) dividing the total area by the coverage per gallon;
2) and then round up to the next whole gallon
calculate the total cost of the paint by:
1) multiplying the total gallons needed by the price of one gallon of paint
output
display the total gallon of paint needed with an appropriate message
display the total cost with an appropriate message
pause so the user can see the answer
******************************************************
Potential Variables
Data Type Identifier Name
********* ***************
double length
double width
double height
double price_gal_paint
int coverage_gal_paint
double total_area
int total_gal_paint
double total_cost