mirror of
https://inf-git.fh-rosenheim.de/studavrije7683/cplusplus-training.git
synced 2025-04-19 22:49:55 +00:00
42 lines
857 B
C++
42 lines
857 B
C++
#include <iostream>
|
|
|
|
using namespace std;
|
|
const int kEauationVal = 32;
|
|
|
|
template <class T>
|
|
void getVal(const char text[], T *val);
|
|
|
|
int main()
|
|
{
|
|
float fahrenheit = 0, schritt_weite = 0, maximal_wert = 0;
|
|
float celsiusBuf[10];
|
|
cout << "Eingabe\n\n";
|
|
getVal("Fahrenheit", &fahrenheit);
|
|
cout << "\nAusgabe\n\n";
|
|
|
|
for (int i = 0; i <10; i++)
|
|
{
|
|
celsiusBuf[i] = ((fahrenheit+i*10 - kEauationVal) * 5) / 9;
|
|
}
|
|
|
|
for (int i = 0; i <10; i++){
|
|
cout<<"Fahrenheit: "<<(fahrenheit+10*i)<<" --> Celsius: "<< celsiusBuf[i]<<endl;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
template <class T>
|
|
void getVal(const char text[], T *val)
|
|
{
|
|
do
|
|
{
|
|
cout << "\t" << text << " = ";
|
|
if (cin.fail())
|
|
{
|
|
cin.clear();
|
|
cin.ignore();
|
|
}
|
|
cin >> *val;
|
|
} while (cin.fail() || *val <= 0);
|
|
}
|