mirror of
https://inf-git.fh-rosenheim.de/studavrije7683/cplusplus-training.git
synced 2025-04-20 02:59:55 +00:00
35 lines
905 B
C++
35 lines
905 B
C++
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
float quadrieren(float); //Deklaration der Funktion quadrieren. Übergabe ist eine Dezimalzahl, Rückgabe ist das Quadrat der übergebenen Zahl
|
|
void kreisflaeche(float radius); //Deklaration der Funktion kreisflaeche. Übergabe ist eine Dezimalzahl (Radius), keine Rückgabe, gibt Kreisfläche aus
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
float quad_zahl;
|
|
float radius;
|
|
|
|
cout << "Bitte geben Sie eine Zahl zum Quadrieren ein: ";
|
|
cin >> quad_zahl;
|
|
cout << endl << "Ergebnis Quadratzahl: " << quadrieren(quad_zahl) << endl << endl;
|
|
|
|
cout << "Bitte geben Sie einen Radius ein: ";
|
|
cin >> radius;
|
|
kreisflaeche(radius);
|
|
|
|
return 0;
|
|
}
|
|
|
|
float quadrieren(float zahl)
|
|
{
|
|
return zahl * zahl; //Zahl quadrieren
|
|
}
|
|
|
|
void kreisflaeche(float r)
|
|
{
|
|
const float pi = 3.14;
|
|
cout << endl << "Ergebnis Kreisfl\204che: " << quadrieren(r)*pi; //Kreisfläche berechnen und ausgeben
|
|
}
|
|
|