mirror of
https://inf-git.fh-rosenheim.de/studavrije7683/cplusplus-training.git
synced 2025-04-20 02:59:55 +00:00
57 lines
1.0 KiB
C++
57 lines
1.0 KiB
C++
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
int main(int argc, char** argv) {
|
|
float fahrenheit;
|
|
float tmp;
|
|
float celsius;
|
|
int schrittweite = 20;
|
|
int maximum = 300;
|
|
|
|
do
|
|
{
|
|
cout << "Fahrenheit: ";
|
|
cin >> fahrenheit;
|
|
}while(fahrenheit<=0);
|
|
|
|
tmp = fahrenheit;
|
|
cout << "Schrittweite: ";
|
|
cin >> schrittweite;
|
|
cout << "Maximum: ";
|
|
cin >> maximum;
|
|
|
|
cout << endl;
|
|
|
|
for(fahrenheit=tmp; fahrenheit <= maximum; fahrenheit+=schrittweite)
|
|
{
|
|
celsius = ((fahrenheit - 32) * 5) / 9;
|
|
cout << "Fahrenheit: " << fahrenheit << "\t| Celsius: " << celsius << endl;
|
|
}
|
|
|
|
cout << endl;
|
|
fahrenheit = tmp;
|
|
|
|
while(fahrenheit <= maximum)
|
|
{
|
|
celsius = (((fahrenheit - 32) * 5) / 9);
|
|
if( celsius <= 10)
|
|
{
|
|
cout << "Es hat " << celsius << " \tGrad und es ist kalt" << endl;
|
|
}
|
|
else if(celsius <= 20)
|
|
{
|
|
cout << "Es hat " << celsius << " \tGrad und es ist angenehm" << endl;
|
|
}
|
|
else
|
|
{
|
|
cout << "Es hat " << celsius << " \tGrad und es wird heiss" << endl;
|
|
}
|
|
fahrenheit += schrittweite;
|
|
}
|
|
|
|
|
|
return 0;
|
|
}
|
|
|