View Single Post
Old 02-03-2004, 10:32 PM   #1 (permalink)
Dilbert1234567
Devils Cabana Boy
 
Dilbert1234567's Avatar
 
Location: Central Coast CA
Simple C question

the general purpose is to enter 3 variables and manipulate them the problem is that the program compiles with 0 errors but crashes when i enter a variable.

i get an aplication error (pop up box with the red X)


error:
Quote:
the instruction at "0x004021b8" references memory at 0x006e0065". The memory could not be "written".

click on ok to terminate the program
click cancel to debug the program.


code of the program

Quote:
#include <stdio.h>

main(void)
{
int nRoomLength=0, nRoomWidth=0, nRoomHeight=0;

double dWidthToLength=0 ; /* width/length */

short int nRoomVolume=0 ; /* nRoomWidth * nRoomLength * nRoomHeight*/

unsigned int nRoomArea=0 ; /* nRoomWidth * nRoomLength */



printf("Please enter a value for the room width:");
scanf("%d, &nRoomLength");
printf("Please enter a value for the room length::");
scanf("%d, &nRoomWidth");
printf("Please enter a value for the room height::");
scanf("%d, &nRoomHeight");

dWidthToLength = nRoomWidth / nRoomLength;
nRoomArea = nRoomLength * nRoomWidth;
nRoomVolume = nRoomLength * nRoomWidth * nRoomHeight;
printf("The area of the floor of the room is: %d, nRoomArea");

printf("The volume of the room is: %d, nRoomVolume");

printf("The ratio of the width to the length is: %d, dWidthToLength");




}
__________________
Donate Blood!

"Love is not finding the perfect person, but learning to see an imperfect person perfectly." -Sam Keen
Dilbert1234567 is offline  
 

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