What is wrong with my temp. converter program?

Hi, I'm new to C++ and still in beginners learning mode, could anyone please tell me what's wrong with the program I made for the temp. conversions?? It doesn't give me any error, but it doesn't convert my values and doesn't work as desired, My head is all messed up right now and I don't know what I did wrong or what was wrong with my approach, any comments/suggestions will be appreciated, thanks :)



#include<iostream>
using namespace std;
main()
{

char x,y;
float value;
cout<<"Temp Conversion"<<endl;
cout<<"Please enter the value"<<endl;
cin>>value;
cout<<"Enter no. of Unit to convert from: \n 1.celcius\n 2.Farenheit\n 3.Kelvin "<<endl;
cin>>x;
cout<<"Enter no. of Unit to convert to : \n 1.celcius\n 2.Farenheit\n 3.Kelvin "<<endl;
cin>>y;
if(x==1)
{
if(y==1)
{
cout<<value<<endl;
}
if(y==2)
{
cout<<(value*9.0/5.0)+32<<endl;
}
if(y==3)
{
cout<<(value+273)<<endl;
}
else
{
cout<<"Invalid Choice"<<endl;
}
}
if(x==2)
{
if(y==1)
{
cout<<(value-32)*5.0/9.0<<endl;
}
if(y==2)
{
cout<<value<<endl;
}
if(y==3)
{
cout<<(value+459.67)*5.0/9.0<<endl;
}
else
{
cout<<"Invalid Choice"<<endl;
}
}
if(x==3)
{
if(y==1)
{
cout<<value-273<<endl;
}
if(y==2)
{
cout<< (value*9.0/5.0) - 459.67<<endl;
}
if(y==3)
{
cout<<value<<endl;
}
else
{
cout<<"Invalid Choice"<<endl;
}
}

else
{
cout<<"Invalid Operation:"<<endl;
}
}









1
2
3
4
5
6
7
8
9
10
11
12
    if(x=='1')
    {
        if(y=='1')
        {
            cout<<value<<endl;
        }
        if(y=='2')
        {
            cout<<(value*9.0/5.0)+32<<endl;
        }
        if(y=='3')
        //... 
Wow, you're a genius sir ..


Many thanks ..!!
Topic archived. No new replies allowed.