Mathematische Funktionen

Eine Reihe von mathematischen Funktionen können über die Bibiothek math.h eingebunden werden.

Ex: Schreibe ein Programm, dass Dir den Floor- bzw. Ceiling-Wert einer reellen Zahl ermittelt.

//---------------------------------------------------------------------------
// Programmname: mathe.cpp
 
#include <iostream>
#include <conio.h>
#include <math.h>
 
using namespace std;
 
int main()
{double zahl;
 cout << "Das ist ein Uebungsprogramm für FLOOR und CEILING\n";
 
 cout << "\nBitte gib eine reelle Zahl ein: ";
 cin >> zahl;
 cout << "\n Floor(" << zahl << ") = " << floor(zahl);
 cout << "\n Ceiling(" << zahl << ") = " << ceil(zahl);
 
 getch();
 return 0;
}
//---------------------------------------------------------------------------