ok... look...
when you initialize a variable with no values, this variables has a random value stored in it. in your program, you assign values to your variables until the end, where you have your switch...
what you have to do is the following:
#include <iostream>
using namespace std;
int main(void)
{
int a,b,c,d,radius,volumeprism;//see how you can declare
//several variables at the
//same time
double volumesphere;//volumesphere must be declared as a
//double so it returns decimal values
cout << "Welcome to the program!\n\n";
cout << "Do you want the volume of:\n";
cout << "1. Cube\n";
cout << "2. Sphere\n";
cout << "3. Exit\n";
cin >> a;
switch (a)
{
case 1:
cout<<"enter length";
cin >> b;
cout<<"enter height";
cin >> c;
cout<<"enter width";
cin >> d;
volumeprism=b*c*d;//the math operation you had @ the
//beginning goes here so it multiplies
//the values you want it to multiply
cout << volumeprism;
break;
case 2:
cout << "enter radius";
cin >> radius;
volumesphere=1.333333333333*3.1415926536*(radius^3);
//here's the other math operation you had up there
cout << volumesphere;
break;
case 3:
return 0;
break;
}
return 0;
}
and that should do the trick...
the problem is you thought a mathematical operation done in a variable would be done every time you gave different values to variables...
well... that doesn't happen in c++ (or even any other languages)...