PDA

View Full Version : Hi im a newbie and need your help plz:)


GeorgeS
07-16-2003, 03:11 AM
Hi Guys
My name is George and im new to the world of c and programming. I joined these forums in the hope that i could expand my knowledge of c and programming and to get tips, help etc.

Im currently in the process of writing, well trying to!, a program which carries out calculations based on the dimensions of a room.

The calculations i need are
area (square meters) of the walls, the door and the window
nett area to be covered by wallpaper


What i have is the following, i was wondering if any 1 could lend a hand and point me in the right direction


#include <stdio.h>
#include <math.h>

int main ( )
{
float v1, v2, v3, v4, v5, v6 , v7;
area;
nett;


*/ Room length, width, height */
printf("Enter the length of the room: ");
scanf("%f", &v1);
printf("Enter the width of the room: ");
scanf("%f", &v2);
printf("Enter the height of the room: ");
scanf("%f", &v3);

*/ Height, width of door */
printf("Enter the height of the door: ");
scanf("%f", &v4);
printf("Enter the width of the door: ");
scanf("%f", &v5);

*/ Height , width of window */
printf("Enter the height of the window: ");
scanf("%f", &v6);
printf("Enter the width of the window: ");
scanf("%f", &v7);


*/ Area of the walls, the door and the window */
area = 2 * (v1 * v3) + (v2 * v3)
printf("The total area is: %0.2f\n", area);


*/ Nett area to be covered by wallpaper */
nett = 2 * v2
printf("The nett area to be covered by wall paper is: %.2f\n, nett);

thanks guys
appreciate it

Best

George

damonbrinkley
07-16-2003, 08:54 AM
OK, so what problems are you having? Error messages while compiling?

If you're asking about how you should go about making the calculations then try this. Get the area of each wall. For the wall with the window, subtract the area of the window from the area of the wall to get area that needs wallpaper. Do the same for the wall with the door. Then add all four wall area sizes together to get total area that will be wallpapered.

DNAunion2000
07-16-2003, 07:30 PM
int main ( )
{
float v1, v2, v3, v4, v5, v6 , v7;
area;
nett;
...


DNAunion: This shouldn't compile. The variables area and nett are not assigned a data type.