My if statements are screwing up
There is something wrong with my program. Every time I run it it tells me that I have made an improper choice. I think it is a problem with my if statements, but could it be that there is something wrong somewhere else???? (I left out my "other_choice" function, so it would be easier to find the problem)
I am using Dev C++ 4.9.8.0 on WinXP
Code:
#include <iostream>
#include <cstdlib>
#include <stdio.h>
using namespace std;
int main_choice(int choice)
{
cout<< "Please make a choice\n";
cout<< "1) box\n";
cout<< "2) cylinder\n";
cout<< "3) sphere\n";
cin>> choice;
return choice;
}
int main()
{
int x;
main_choice(x);
if(x==1)
{
cout<< "You chose to make a box!!!\n";
int y;
other_choice(y);
}
else if(x==2)
{
cout<< "You chose to make a cylinder!!!\n";
int y;
other_choice(y);
}
else if(x==3)
{
cout<< "You chose to make a sphere!!!\n";
int y;
other_choice(y);
}
else
{
cout<< "You did not make a proper choice\n";
system("Pause");
return 0;
}
system("PAUSE");
return 0;
}
Thanx in advance