OHVicktoriaSteve
2009-06-04 22:37:00 UTC
1. When I press Cube or cylinder, it displays the word "cube" or "cylinder" but then takes me back to the "box" option
2. When I compute the digits for box there's alway an error at the end (before it give me the answer).
#include "simpio.h"
#include "genlib.h"
#include
#include
#include
#define strEqual
main()
{
string option;
int box, cylinder, cube, x, y, z, vol, pi;
pi=3.1415926;
printf("Enter 'box', 'cylinder', or 'cube'\n");
option=GetLine();
if (strEqual(option, "box"))
{
printf("For box:\n");
printf("Enter the first side of the box:\n");
x=GetInteger();
printf("Enter the second side of the box:\n");
y=GetInteger();
printf("Enter the height of the box:\n");
z=GetInteger();
vol =(x*y*z);
printf("Volume of the box is %s\n", vol);
}
else if (strEqual(option, "cube"))
{
printf("For cube\n");
printf("Enter the side of the cube:\n");
x=GetInteger();
vol = (x*x*x);
printf("Volume of the cube is %d\n",vol);
}
else if (strEqual(option, "cylinder"))
{
printf("For cylinder:\n");
printf("Enter the diameter of cylinder:\n");
x=GetInteger();
printf("Enter the length of the cylinder:\n");
y=GetInteger();
vol=(x * x* pi / (4 * y));
printf("Vomlume of the cylinder is %d\n",vol);
}
system("pause");
}