Celsius To Fahrenheit C Program
Hi everyone. I'm fairly new to C++ and I'm wondering if anyone can help me with this code. My assignment was to write a program that creates and displays a table of temperature conversions. Get the starting temperature from the keyboard in degrees Celsius (do not allow input of a value below absolute zero). Also get an integer value to represent the number of degrees to increment for each of a 20 row table (do not allow the increment value to be less than one. This is what I have so far
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double C,F,K,R,n,i;
cout <<'Enter starting temperature in Celsius: ';
cin >> C;
while (C <= -273.15)
{
cout <<'ERROR: Temp must be >= -273.15: ';
cin >> C;
}
{
n = n--;
cout << 'Enter increments in degrees Celsius: ';
cin >> n;
}
{
i= 1; i++;
F= C * 1.8+32;
K= C + 273.15;
R= C * 1.8+32+459.67;
}
{
cout <<' #t Celst Fahrt Kelvt Rank' <<endl;
}
cout <<' ' << n << setw(4) << ' ' << C << setw(4) << ' ' << F
<< setw (6) << ' ' << K << setw (6) << ' ' << R << endl;
}
But when I put this through it only brings up the specfic thing I asked for and not the whole table. The program needs to output like this
Enter starting temperature in Celsius: -500
ERROR: Temp must be >= -273.15: -273.15
Enter increments in degrees Celsius: 100
# Cels Fahr Kelv Rank
1 -273.15 -459.67 0.00 0.00
2 -173.15 -279.67 100.00 180.00
3 -73.15 -99.67 200.00 360.00
4 26.85 80.33 300.00 540.00
5 126.85 260.33 400.00 720.00
6 226.85 440.33 500.00 900.00
7 326.85 620.33 600.00 1080.00
8 426.85 800.33 700.00 1260.00
9 526.85 980.33 800.00 1440.00
10 626.85 1160.33 900.00 1620.00
11 726.85 1340.33 1000.00 1800.00
12 826.85 1520.33 1100.00 1980.00
13 926.85 1700.33 1200.00 2160.00
14 1026.85 1880.33 1300.00 2340.00
15 1126.85 2060.33 1400.00 2520.00
16 1226.85 2240.33 1500.00 2700.00
17 1326.85 2420.33 1600.00 2880.00
18 1426.85 2600.33 1700.00 3060.00
19 1526.85 2780.33 1800.00 3240.00
20 1626.85 2960.33 1900.00 3420.00
Press any key to continue . . .
Can anyone help me?
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double C,F,K,R,n,i;
cout <<'Enter starting temperature in Celsius: ';
cin >> C;
while (C <= -273.15)
{
cout <<'ERROR: Temp must be >= -273.15: ';
cin >> C;
}
{
n = n--;
cout << 'Enter increments in degrees Celsius: ';
cin >> n;
}
{
i= 1; i++;
F= C * 1.8+32;
K= C + 273.15;
R= C * 1.8+32+459.67;
}
{
cout <<' #t Celst Fahrt Kelvt Rank' <<endl;
}
cout <<' ' << n << setw(4) << ' ' << C << setw(4) << ' ' << F
<< setw (6) << ' ' << K << setw (6) << ' ' << R << endl;
}
But when I put this through it only brings up the specfic thing I asked for and not the whole table. The program needs to output like this
Enter starting temperature in Celsius: -500
ERROR: Temp must be >= -273.15: -273.15
Enter increments in degrees Celsius: 100
# Cels Fahr Kelv Rank
1 -273.15 -459.67 0.00 0.00
2 -173.15 -279.67 100.00 180.00
3 -73.15 -99.67 200.00 360.00
4 26.85 80.33 300.00 540.00
5 126.85 260.33 400.00 720.00
6 226.85 440.33 500.00 900.00
7 326.85 620.33 600.00 1080.00
8 426.85 800.33 700.00 1260.00
9 526.85 980.33 800.00 1440.00
10 626.85 1160.33 900.00 1620.00
11 726.85 1340.33 1000.00 1800.00
12 826.85 1520.33 1100.00 1980.00
13 926.85 1700.33 1200.00 2160.00
14 1026.85 1880.33 1300.00 2340.00
15 1126.85 2060.33 1400.00 2520.00
16 1226.85 2240.33 1500.00 2700.00
17 1326.85 2420.33 1600.00 2880.00
18 1426.85 2600.33 1700.00 3060.00
19 1526.85 2780.33 1800.00 3240.00
20 1626.85 2960.33 1900.00 3420.00
Press any key to continue . . .
Can anyone help me?
Dev C++ Fahrenheit To Celsius Converter Calculator
- C Program to convert farenheit to celcius Introduction. C Program to convert farenheit to celcius. I have used Dev-C IDE for debugging purpose. But you can use any C programming language compiler as per your compiler availability.
- How to convert Fahrenheit to Celsius. 0 degrees Fahrenheit is equal to -17.77778 degrees Celsius: 0 °F = -17.77778 °C. The temperature T in degrees Celsius (°C) is equal to the temperature T in degrees Fahrenheit (°F) minus 32, times 5/9.
- C Exercises: Convert temperature in Celsius to Kelvin Last update on February 26 2020 08:09:11 (UTC/GMT +8 hours) C Basic: Exercise-27 with Solution. Write a program in C to convert temperature in Celsius to Kelvin. Write a program in C to convert temperature in Fahrenheit to Kelvin.
- The Fahrenheit scale is a temperature scale that defines the melting point of water as 32 degrees and the boiling point of water at 212 degrees. There are 180 intervals between 32 °F and 212 °F, each corresponding to one degree.
- C program to Convert Fahrenheit to Celsius - We have standard formula to Convert Celsius to Fahrenheit using this formula you can change temperature Fahrenheit to Celsius. Tutorials, Free Online Tutorials, sitesbay provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, ajax, core.
Mar 14, 2019 In this program we will see how to convert Celsius to Fahrenheit using C. As we know the formula is simple. Algorithm Begin Take the Celsius temperature in C calculate F.