okay, so I've been messing around with the code, and I still cant get the hang of the do while loop. can anybody explain to me exactly what I'm doing wrong? also the total always equals $0. here is my current code:
Code:
main() { /*Written by Brandon Benyacar*/
int area, labour, length, width, height=8, ceiling, setup=100, paint;
float total, room;
{printf("Painting Cost Estimator \n Enter length of room in feet: \n"); /*prompt user to input values*/
scanf("%d", &length);
printf("Enter width of room in feet: \n ");
scanf("%d", &width);}
{{ printf("Please select grade of paint to use for walls: \n 1 - Basic \n 2 - Regular \n 3 - Premium \n"); /*assign cost to paint*/
scanf ( "%d", &paint );
if( paint == 1 )
paint = 20;
else
if( paint == 2 )
paint = 30;
else
if( paint == 3 )
paint = 40;
else
printf ("Please select a grade of paint that actually exists!!! \n");}
while ( paint <= 0 || paint > 3 ); }
{ printf("Enter if ceiling is to be painted: \n 1 Yes \n 2 No \n"); /* Define whether ceiling is to be included in cost*/
scanf("%d", &ceiling);
while ( ceiling = 0 || ceiling > 2 );
if( ceiling == 1 )
ceiling = (length*width);
else
if( ceiling == 2 )
ceiling = 0;
else
printf ("You made an incorrect selection. Please choose whether the ceiling is to be painted: \n");}
{area=(2*length*height)+(2*width*height)+ceiling;
printf("%d sq.feet \n", area);}
{labour=(area/200)*2;
room=((area)*paint)*2;
total=room+setup+labour;
printf ("Total: $%d \n", total);
}
}
keep in mind ive been messing around with the code so not every little detail will be exactly as intended.