need some help with a program

OK im gonna post the program i need to make and ill show you guys my code and ill explain my problem



The program should prompt the user for the total number of rooms in the house, then allow the user to enter the length and width of each room individually. After all the data entry has been performed, the program should display the total square footage of the house. Here's what a sample run looks like:

How many rooms? 5
Room #1:
Enter length: 20
Enter width: 35
Room #2:
Enter length: 18.7
Enter width: 25.3
Room #3:
Enter length: 12.1
Enter width: 15
Room #4:
Enter length: 28.6
Enter width: 22.2
Room #5:
Enter length: 26
Enter width: 11.4
The total square feet is 2285.9300
A few things to take note of:
The values entered may contain decimal points.
The total square feet is expressed as a floating point value.
The total square feet uses four digits of precision.

Naturally, since this is a programming class you don't get to write this program any which way you prefer, there are a few rules to this game. The main function will be responsible for getting the number of rooms from the user. Then this value is passed as input to the CalcSquareFeet function. What CalcSquareFeet does is prompt the user for the length and width of each room and return the total square footage to the caller. However, to derive the area of each individual room, CalcSquareFeet will call on another function CalcArea. This function will receive length and width values for a single room and return the area back to the caller.


My code

while (value > 0);
{
cout << "Room #" << value << ":";
cout << " Enter Length: ";
cin >> height;
cout << " Enter Width: ";
cin >> width;
value = value - 1;
}


my problem is i need this function to repeat the # of times the user inouts for the # of rooms and i can only get it to propmt the user once. PLease some one help
Hi seanybarra:

First of all, you have a semi-colon ending your "while" loop:

1
2
3

while( value > 0 ) ; 


So the "while" loop only executes once (just remove the semi-colon.)

Topic archived. No new replies allowed.