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

Design, create, and test a program which converts degrees Fahrenheit to degrees

ID: 3558356 • Letter: D

Question

Design, create, and test a program which converts degrees Fahrenheit to degrees Centigrade (Celsius). The program must contain one main program and 3 functions: F2C() and C2F() and instructions(). The user will be asked to enter a numeric code to determine the operation. If the input code = 1, then convert F to C, if the code = 2, then convert C to F, if the input code = 3, then display instructions, and if the code = 4, then quit. The program should be in a "loop" that repeatedly performs conversions until the user quits, then the program stops. Display the instructions one time when the program starts (or whenever the user enters code = 3). Keep inputs and outputs (except for instructions) in the main program. Use F2C() and C2F() to perform conversion only.

Explanation / Answer

#include <iostream>

using namespace std;

void instructions();
int c2f();
int f2c();

int c2f()
{
int c;
int choice;
cout << "Please enter the degree in Celsius: ";
cout << ":.: ";
cin >> c;
cout << ":F: " << c * 1.8 + 32 << endl;
cin.get();

cout << "Convert another degree? ";
cout << "1. Yes. ";
cout << "2. No. ";
cout << ":.: ";
cin >> choice;

if (choice == 1)
{
instructions();
}

  
return 0;
  
}

int f2c()
{
int f;
int choice;
cout << "Please enter the degree in Fahrenheit: ";
cout << ":.: ";
cin >> f;
cout << ":C: " << (f - 32) * 5 / 9 << endl;
cin.get();

cout << "Convert another degree? ";
cout << "1. Yes. ";
cout << "2. No. ";
cout << ":.: ";
cin >> choice;

if (choice == 1)
{
instructions();
}

  
return 0;
  
}

void instructions()
{
int choice;
cout << "Please choose your desired option:- ";
cout << "1. Celsius to Fahrenhite. ";
cout << "2. Fahrenhite to Celsius. ";
cout << ":.: ";
cin >> choice;

if (choice == 1)
{
c2f();
}

else if (choice == 2)
{
f2c();
}
}

int main()
{
cout << "This program allows you to convert from Celsius to Fahrenheit and vice versa. ";
instructions();
   return 0;
   }

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