From a82301cc5bc67013e470b41dc97195926c8a8266 Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Thu, 19 Oct 2023 12:35:20 +0200 Subject: [PATCH] Created the 1st solution_2.cpp --- units/2023_10_19/solution_2.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 units/2023_10_19/solution_2.cpp diff --git a/units/2023_10_19/solution_2.cpp b/units/2023_10_19/solution_2.cpp new file mode 100644 index 0000000..949f20e --- /dev/null +++ b/units/2023_10_19/solution_2.cpp @@ -0,0 +1,22 @@ +#include + +using namespace std; + +int main() { + // Variablen deklarieren + int length, width; + + // Benutzer nach Laenge und Breite fragen + cout << "Geben Sie die Laenge (in cm) ein: "; + cin >> length; + + cout << "Geben Sie die Breite (in cm) ein: "; + cin >> width; + + int perimeter = 2 * (length + width); + int area = length * width; + + // Ergebnis ausgeben + cout << "Der Umfang betraegt " << perimeter << " cm." << endl; + cout << "Die Flaeche betraegt " << area << " qcm.." << endl; +} \ No newline at end of file