Hey all, i'm a freshmen in college who is taking Intro to Computer Science with C++ and i'm just a beginner when it comes to programming so i have a problem. This is our assignment: You are to write a program which inputs a Celsius temperature from the user, converts it to Fahrenheit and displays both temperatures on the screen. Allow the user to enter the temperature as a real number such as 56.5. Show the temperatures with 1 digit after the decimal point. This is what i got so far:
// This program is going to convert Celsius temperatures to Fahrenheit temperatures
// The user will provide the celsius degrees temperature.
// The program will show the celsius degree temperature and convert it to fahrenheit
// temperature while showing both the celsius and fahrenheit temperatures.
#include <iostream>
#include <iomanip.h>
using namespace std;
int main()
{
double Celsius; // Number of Celsius degrees
double Fahrenheit; // Number of Fahrenheit degrees
// Explain the program to the user
cout << "This program will calculate the Celsius and Fahrenheit temperatures.\n";
cout << "You must provide the Celsius temperature.\n";
cout << endl;
// Get information
// Get numbers for Celsius degrees
cout << "Enter the number of Celsius degrees: ";
cin >> Celsius;
// Perform calculations
// Convert Celsius to Fahrenheit
//Celsius to Fahrenheit= F = C * 9 / 5 + 32;
// Display results
// Display Celsius
cout << endl;
cout << "Celsius: " << Celsius << " degrees" << endl;
// Display Fahrenheit
cout << setiosflags(ios::fixed) << setprecision(2);
cout << "Fahrenheit: " << Fahrenheit << " degrees" << endl;
system("PAUSE");
return 0;
}
I was wondering what else I need to put in here so i can have fahrenheit answers like 56.5 instead of just 56, thanks alot for helping out a poor freshman.