Answer to Question #183965 in C++ for Alishan khattak

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)


1
Expert's answer
2021-04-21T12:42:44-0400
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS