Question

Locked

'System.AccessViolationException'

By kbikkasani ·
This program crashes every time I run it. The debugger error is

"An unhandled exception of type 'System.AccessViolationException' occurred in volumes.exe

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

My program is just to find the volume of a cube if the user enters the string cube but I cannot get the if statement to start.
Here is the program

#include <stdio.h>
#include "genlib.h"
#include "simpio.h"
#include "string.h"

int main()
{
int i;
string shape, cube, box, cylinder;
printf ("Please enter the shape:");
shape=GetLine();
i = strcmp( shape, cube );

if (i==0)
{
double s, cvol;
printf ("Enter side length");
s=GetReal();
cvol=s*s*s;
printf ("The volme of a cube with side length= %lf is %lf\n", s, cvol);
}
}

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Windows Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums