Jetzt geht es wieder mit C++ weiter. Wie wäre es mal mit einem Programm zur Wurzelberechnung? Dieser Artikel bietet den entsprechenden C++ Code…


C++ Wurzelrechner Version 1:

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
double eingabe;
double wurzel;

cout << "Programm zur Wurzelberechnung" << endl;
cout << endl;
cout << "Geben Sie eine Zahl ein: " ;
cin >> eingabe;

if (eingabe >= 0)
{
wurzel = sqrt(eingabe);
cout << "Wurzel von " << eingabe << " = "
<< wurzel << endl;
}

cout << endl;
cout << "Programm wird beendet. ";
cout << endl;

return 0;
}

Von Torsten