C++ program to pass temperature in Centigrade as a reference variable and change this value into Fahrenheit

#include <iostream>
#include <iomanip>
using namespace std;
void TempConversion(float *,float *);
int main()
{
    float ct,ft=0.0;
    cout<<"Enter temperature in Centigrade: ";
    cin>>ct;
    cout<<"Before conversion: "<<ct<<setw(5)<<ft<<endl;
    TempConversion(&ct,&ft);
    cout<<"After conversion: "<<ct<<setw(5)<<ft<<endl;
    return 0;
}
void TempConversion(float *x,float *y)
{
    *y=(9/5)*(*x)+32;
}

No comments:

Post a Comment