can someone help me i can't seem to find my temperature problem

/****************************
*    functions
*****************************/
float c2F(float);
float f2C(float);

/****************************
*    gloabal variables
*****************************/

int main ()
{
    float inTemp;
    float newTemp;
    char inCode;
    
    cout << "please enter the code (a 'C' of 'F'): ";
    cin >> inCode;
    
    cout << "please enter the tempature to be converted: ";
    cin >> inTemp;
    
    if (inCode == 'C')
    {
               newTemp = c2F(inTemp);
               cout << "converted temp is " << newTemp << "\n";
    }
    else if (inCode == 'F')
    {
               newTemp = f2C(inTemp);
               cout << "converted temp is " << newTemp << "\n";
    }
    else
    {
        newTemp = 0;
        cout << "bad code entered\n";
    }
               
    system("pause");
    
    return 0;
}
/****************************
*    converts a temp from F->C using the formula F=5/9(C-32)
*****************************/
float f2C (float inTemp)
{
      float newTemp = 5/9* (inTemp-32);
      return newTemp;
}
/****************************
*    converts a temp from C->F the formula C=9/9(F) +32
*****************************/
float c2F (float inTemp)
{
      float newTemp = 9/5* inTemp+32;
      return newTemp;
}

What is the problem ..specify that..and put brackets in the formula to avoid confusion and miscalculation

i updated the my code up there again and like when I run it the answer turns out wrong

/****************************
*    functions
*****************************/
float c2F(float);
float f2C(float);

/****************************
*    gloabal variables
*****************************/

int main ()
{
    float inTemp;
    float newTemp;
    char inCode;
    
    cout << "please enter the code (a 'C' of 'F'): ";
    cin >> inCode;
    
    cout << "please enter the tempature to be converted: ";
    cin >> inTemp;
    
    if (inCode == 'C')
    {
               newTemp = c2F(inTemp);
               cout << "converted temp is " << newTemp << "\n";
    }
    else if (inCode == 'F')
    {
               newTemp = f2C(inTemp);
               cout << "converted temp is " << newTemp << "\n";
    }
    else
    {
        newTemp = 0;
        cout << "bad code entered\n";
    }
               
    system("pause");
    
    return 0;
}
/****************************
*    converts a temp from F->C using the formula F=5/9(C-32)
*****************************/
float f2C (float inTemp)
{
      float newTemp = 5/9* (inTemp-32);
      return newTemp;
}
/****************************
*    converts a temp from C->F the formula C=9/9(F) +32
*****************************/
float c2F (float inTemp)
{
      float newTemp = 9/5* inTemp+32;
      return newTemp;
}

With integer math 9/5 is 1 and 5/9 is zero. Try 9.0/5.0 and 5.0/9.0.

thanks I figure out that I was trying to divide a int by a float which wouldn't work of course. changing it to 9.0 and 5.0 works

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.