Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ in Linux Program 1: Write a small Linux program that will calculate the temp

ID: 3774775 • Letter: C

Question

C++ in Linux

Program 1:

Write a small Linux program that will calculate the temperature in degrees F, given the temperature in degrees C, where C is 34.5. (The formula is.. F = (9/5) * C + 32.0).

You must perform the calculation as a separate function such as convert(C). The caller invokes the function as in convert(34.5)

Your program should print out the corresponding Fahrenheit degrees, and then terminate.

Program 2:

Write a small Linux program that will calculate the temperature in degrees F, given the temperature in degrees C. (The formula is.. F = (9/5) * C + 32.0).

From Program 1, you must perform the calculation as a separate function, namely convert(C).

Your program should ask the user to input a temperature in Centigrade and then return Fahrenheit. Continue until the user quits.

Explanation / Answer

Program 1:

#include<iostream>
using namespace std;
void convert(float);

int main()
{
float celsius=34.5;
   convert(celsius);
return 0;
}

void convert(float c)
{
   float fahrenheit;
   fahrenheit = (c * 9.0) / 5.0 + 32;
cout << "Fahrenheit Temperature: " << fahrenheit << endl;
}

Program 2:

#include<iostream>
using namespace std;
void convert(float);

int main()
{
float celsius;
char ch;
do{
        cout << "Enter the temperature in Celsius : ";
   cin >> celsius;
       convert(celsius);
       cout<<"Do you want to enter temperature in Celsius again ? (y/Y)";
   }while(ch=='y' || ch=='Y');
return 0;
}

void convert(float c)
{
   float fahrenheit;
   fahrenheit = (c * 9.0) / 5.0 + 32;
cout << "Fahrenheit Temperature: " << fahrenheit << endl;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote