Hi, so im trying to create a string program in which the user types in "box", "cylinder", or "cube", then the program asks the user for the dimensions of the given shape, then outputs the volume.
Code:
#include <stdio.h>
#include "genlib.h"
#include "simpio.h"
#include "strlib.h"
int main()
{
int r,h,l,s,w,Volume1,Volume2,Volume3,Box,Cylinder,Cube;
string choice;
printf("Please Enter the shape:");
choice=GetLine();
if( GetLine()=Box)
{
printf("Enter Width:");
w=GetInteger();
printf("Enter Height:");
h=GetInteger();
printf("Enter Length:");
l=GetInteger();
Volume1=w*h*l;
printf("The Volume is : %s\n",Volume1);
}
else if( GetLine()=Cylinder)
{
printf("Enter Radius");
r=GetInteger();
printf("Enter Height");
s=GetInteger();
Volume2=3.14*r*r*h;
printf("The Volume is: %s",Volume2);
}
else if ( GetLine()=Cube)
{printf("Enter the Side Length");
s=GetInteger();
Volume3=s*s*s;
printf("The volume is: %s",Volume3);
}
}
However, i keep getting this error message: error C2440: '=' : cannot convert from 'int' to 'string'. For example it is in line 24.
Can someone please help?