cplusplus-training/Teil_1/5. Felder/Lösungen/Loesung Uebung 2 - Fahrenheit in Celsius.cpp
2021-10-15 08:36:02 +02:00

36 lines
550 B
C++

#include <iostream>
using namespace std;
int main(int argc, char** argv) {
float celsius[10];
float fahrenheit;
float tmp;
int schrittweite = 10;
int i = 0;
cout << "Fahrenheit: ";
cin >> fahrenheit;
tmp = fahrenheit;
cout << endl;
for(i = 0; i < 10; i++)
{
celsius[i] = ((fahrenheit - 32) * 5) / 9;
fahrenheit += schrittweite;
}
i = 0;
fahrenheit = tmp;
while(i < 10)
{
cout << "Fahrenheit: " << fahrenheit << "\t| Celsius[" << i << "]: " << celsius[i] << endl;
fahrenheit += schrittweite;
i++;
}
return 0;
}