diff options
| author | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
|---|---|---|
| committer | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
| commit | 33613a85afc4b1481367fbe92a17ee59c240250b (patch) | |
| tree | 670b842326116b376b505ec2263878912fca97e2 /Bachelor/Prog1/Prakt1/prg1pr1_3/prg1pr1_3.cpp | |
| download | Studium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.gz Studium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.bz2 | |
Diffstat (limited to 'Bachelor/Prog1/Prakt1/prg1pr1_3/prg1pr1_3.cpp')
| -rw-r--r-- | Bachelor/Prog1/Prakt1/prg1pr1_3/prg1pr1_3.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/Bachelor/Prog1/Prakt1/prg1pr1_3/prg1pr1_3.cpp b/Bachelor/Prog1/Prakt1/prg1pr1_3/prg1pr1_3.cpp new file mode 100644 index 0000000..880b7b9 --- /dev/null +++ b/Bachelor/Prog1/Prakt1/prg1pr1_3/prg1pr1_3.cpp @@ -0,0 +1,50 @@ +// Programmieren 1, Praktikum 1, Aufgabe 3
+// Sven Eisenhauer
+// 27.10.2004
+
+#include <iostream>
+
+int main()
+{
+ int iInOp1,iInOp2,iInOp3; // 3 operants, user input
+ int iMin,iMax;
+
+ std::cout << "Bitte drei unterschiedliche ganze Zahlen eingeben:\n";
+ std::cin >> iInOp1;
+ std::cin >> iInOp2;
+ std::cin >> iInOp3;
+ std::cout << "\nDie Summe ist " << iInOp1 + iInOp2 + iInOp3;
+ std::cout << "\nDer Mittelwert ist "<< (static_cast <double> (iInOp1 + iInOp2 + iInOp3))/3;
+ std::cout << "\nDas Produkt ist " << (iInOp1 * iInOp2 * iInOp3);
+
+ if (iInOp1<iInOp2 && iInOp1<iInOp3)
+ {
+ iMin=iInOp1;
+ }
+ if (iInOp2<iInOp1 && iInOp2<iInOp3)
+ {
+ iMin=iInOp2;
+ }
+ if (iInOp3<iInOp1 && iInOp3<iInOp2)
+ {
+ iMin=iInOp3;
+ }
+
+ if (iInOp1>iInOp2 && iInOp1>iInOp3)
+ {
+ iMax=iInOp1;
+ }
+ if (iInOp2>iInOp1 && iInOp2>iInOp1)
+ {
+ iMax=iInOp2;
+ }
+ if (iInOp3>iInOp1 && iInOp3>iInOp1)
+ {
+ iMax=iInOp3;
+ }
+
+ std::cout << "\nDer kleinste Wert ist "<<iMin;
+ std::cout << "\nDer groesste Wert ist "<<iMax<<"\n";
+
+ return 0;
+}
\ No newline at end of file |
