Hi,
ich habe hier mal einen Quelltext aus einem Lehrbuch für C++, leider verstehe ich überhaupt nicht, was das Programm machen soll. Kann mir da vielleicht jemand weiterhelfen?
Danke.
Gruß
Olli
ich habe hier mal einen Quelltext aus einem Lehrbuch für C++, leider verstehe ich überhaupt nicht, was das Programm machen soll. Kann mir da vielleicht jemand weiterhelfen?
Danke.
Code:
#include <iostream>
using namespace std;
const int MAX = 256;
int main()
{
char input[MAX];
int i = 0;
double Wert = 0;
cin.getline(input, MAX);
while(input[i] >= '0' && input[i] <= '9')
{
Wert *= 10;
Wert += input[i] - '0';
i++;
}
if(input[i] == ',')
{
double NK = 1;
i++;
while(input[i] >= '0' && input[i] <= '9')
{
NK *= 10;
Wert += (input[i] - '0') / NK;
i++;
}
}
cout << input << Wert << endl;
system("pause");
return 0;
}
Gruß
Olli