Question #183965

Write a program to convert Fahrenheit to Celsius degrees by passing pointers

as arguments to the function?

(Take value from the user at runtime)


Expert's answer

#include <iostream>
using namespace std;

void farenheit2celsius(double *temperature) {
    *temperature = (*temperature - 32.) * 5. / 9.;
}

int main() {
    double temperature;
    cout << "Enter temperature (F): ";
    cin >> temperature;
    farenheit2celsius(&temperature);
    cout << "It is " << temperature << " C" << endl;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS