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/Prakt3 | |
| download | Studium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.gz Studium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.bz2 | |
Diffstat (limited to 'Bachelor/Prog1/Prakt3')
| -rw-r--r-- | Bachelor/Prog1/Prakt3/index.htm | 197 | ||||
| -rw-r--r-- | Bachelor/Prog1/Prakt3/prg1p3_1/main.cpp | 65 | ||||
| -rw-r--r-- | Bachelor/Prog1/Prakt3/prg1p3_1/prg1p3_1.dsp | 100 | ||||
| -rw-r--r-- | Bachelor/Prog1/Prakt3/prg1p3_1/prg1p3_1.dsw | 29 | ||||
| -rw-r--r-- | Bachelor/Prog1/Prakt3/prg1p3_2/main.cpp | 81 | ||||
| -rw-r--r-- | Bachelor/Prog1/Prakt3/prg1p3_2/prg1p3_2.dsp | 100 | ||||
| -rw-r--r-- | Bachelor/Prog1/Prakt3/prg1p3_2/prg1p3_2.dsw | 29 | ||||
| -rw-r--r-- | Bachelor/Prog1/Prakt3/prg1p3_3/main.cpp | 57 | ||||
| -rw-r--r-- | Bachelor/Prog1/Prakt3/prg1p3_3/prg1p3_3.dsp | 100 | ||||
| -rw-r--r-- | Bachelor/Prog1/Prakt3/prg1p3_3/prg1p3_3.dsw | 29 | ||||
| -rw-r--r-- | Bachelor/Prog1/Prakt3/prg1p3_4/main.cpp | 43 | ||||
| -rw-r--r-- | Bachelor/Prog1/Prakt3/prg1p3_4/prg1p3_4.dsp | 100 | ||||
| -rw-r--r-- | Bachelor/Prog1/Prakt3/prg1p3_4/prg1p3_4.dsw | 29 | ||||
| -rw-r--r-- | Bachelor/Prog1/Prakt3/prg1p3_5/main.cpp | 67 | ||||
| -rw-r--r-- | Bachelor/Prog1/Prakt3/prg1p3_5/prg1p3_5.dsp | 100 | ||||
| -rw-r--r-- | Bachelor/Prog1/Prakt3/prg1p3_5/prg1p3_5.dsw | 29 |
16 files changed, 1155 insertions, 0 deletions
diff --git a/Bachelor/Prog1/Prakt3/index.htm b/Bachelor/Prog1/Prakt3/index.htm new file mode 100644 index 0000000..367abf1 --- /dev/null +++ b/Bachelor/Prog1/Prakt3/index.htm @@ -0,0 +1,197 @@ +<html><head>
+<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
+<meta name="ProgId" content="FrontPage.Editor.Document">
+<title>Praktikum 3</title></head>
+
+<body>
+
+
+<table border="1" cellspacing="0" width="100%">
+<caption> </caption>
+
+<tbody><tr>
+<td bgcolor="#efefde" width="25%">FH Darmstadt
+<br>FB Informatik
+<br>Prof.Dr. H.P.Weber</td>
+
+<td>
+<center><font size="+3">Programmieren I </font>
+<br><font size="+3">Praktikum</font></center>
+</td>
+
+<td bgcolor="#efefde" width="25%">
+<center><font size="+4">3</font></center>
+</td>
+</tr>
+</tbody></table>
+
+<br>
+<table border="1" width="100%">
+<tbody><tr valign="top">
+<td>Ziel:</td><td> Sie sollen den modularen Programmaufbau mit
+Funktionen, die Simulation von Zufallsereignissen und einfache
+Rekursion üben.
+</td>
+</tr>
+</tbody></table>
+
+<br>
+<table border="1" cellspacing="0" width="100%">
+<tbody><tr>
+<td>
+<h3>
+<b>1 Verwenden einer einfachen Funktion</b></h3>
+
+<ul>
+<li>
+Schreiben Sie eine Funktion, die die Uhrzeit als drei <b>
+<font face="Courier New">integer</font></b>-Argumente übernimmt (<b><font face="Courier New">hour</font></b>,
+<b><font face="Courier New">minute</font></b>, <b><font face="Courier New">
+second</font></b>) und die Anzahl der Sekunden seit 0 Uhr zurückgibt.</li>
+
+<li>
+Benutzen Sie diese Funktion, um die Zeitspanne in Sekunden zwischen zwei
+Zeitpunkten (am gleichen Tag) zu berechnen.</li>
+</ul>
+</td>
+</tr>
+</tbody></table>
+
+<br>
+<table border="1" cellspacing="0" width="100%">
+<tbody><tr>
+<td>
+<h3>
+<b>2 Einfache Simulation und Analyse von Zufallsereignissen</b></h3>
+
+<ul>
+<li>
+Schreiben Sie ein Programm, das simuliert, zwei Würfel 6000mal
+zu werfen. </li>
+
+<li>
+Ergänzen Sie die Simulation um eine Häufigkeitstabelle, die angibt,
+wie oft die möglichen Augenzahlen eines Wurfes (2 bis 12) gefallen sind. </li>
+</ul>
+</td>
+</tr>
+</tbody></table>
+
+<br>
+
+<table border="1" cellspacing="0" width="100%">
+<tbody><tr>
+<td>
+<h3>
+<b>3 Vollkommene Zahlen </b></h3>
+
+<ul>
+<li>
+Eine ganze Zahl wird eine <i>vollkommene Zahl</i> genannt, falls die Summe ihrer
+Faktoren (also der Zahlen, durch die die Zahl ohne Rest teilbar ist) gleich der Zahl selbst
+ist. Bei der Bildung der Summe wird die 1 eingeschlossen, aber nicht die Zahl
+selbst. Zum Beispiel ist 6 eine vollkommene Zahl, denn es gilt 6 = 1 + 2 + 3.</li>
+
+<li>
+Schreiben Sie eine Funktion <b><font face="Courier New">isPerfect</font></b>,
+die bestimmt, ob ihr Parameter <b><font face="Courier New">number</font></b> eine
+vollkommene Zahl ist.</li>
+
+<li>
+Benutzen Sie diese Funktion in einem Programm, das alle vollkommenen Zahlen
+zwischen 1 und 1000 bestimmt und ausgibt. Geben Sie die Faktoren jeder
+vollkommenen Zahl mit aus, damit Ihr Ergebnis besser überprüft werden kann.</li>
+
+<li>
+Fordern Sie die Rechenleistung Ihres Computers, indem Sie Zahlen testen, die
+deutlich größer als 1000 sind. </li>
+</ul>
+</td>
+</tr>
+</tbody></table>
+
+
+
+<br>
+<table border="1" cellspacing="0" width="100%">
+<tbody><tr>
+<td>
+ <b><h3>4 Größter gemeinsamer Teiler - rekursiv</h3></b>
+
+<ul>
+<li>
+Der größte gemeinsame Teiler (greatest common divisor: gcd) zweier ganzer Zahlen
+x und y ist die größte ganze Zahl, die x und y ohne Rest teilt.</li>
+
+<li>
+Schreiben Sie eine rekursive Funktion <b> <font face="Courier New">gcd</font></b><font face="Times New Roman">,
+die </font>den größten gemeinsamen Teiler von x und y zurückgibt. Nutzen Sie
+dabei folgende rekursive Beziehung:</li>
+
+<li>
+Falls y gleich 0 ist, dann ist <b> <font face="Courier New">gcd(x,y)</font></b>
+gleich <b> <font face="Courier New">x</font></b>.<br>
+Sonst gilt: <b> <font face="Courier New">gcd(x,y)</font></b> ist <b> <font face="Courier New">
+gcd(y,x%y)</font></b>.</li>
+
+<li>
+Testen Sie Ihre Funktion, indem Sie Werte für x und y einlesen und den
+zugehörigen größten gemeinsamen Teiler ausgeben.</li>
+
+</ul>
+</td>
+</tr>
+</tbody></table>
+
+<br>
+<table border="1" cellspacing="0" width="100%">
+<tbody><tr>
+<td>
+ <b><h3>5 Ägyptische Multiplikation (fakultativ)</h3></b>
+
+<ul>
+<li>
+Schreiben Sie eine Funktion <font face="Courier New"><b>multIterative</b></font>,
+die das Produkt zweier ganzer Zahlen a und b auf folgende Weise berechnet.<br>
+Ausgehend von den der Funktion übergebenen Werten a und b wird eine
+Reihe von gleichartigen Schritten durchgeführt:
+<ul>
+<li>
+Falls b ungeradzahlig ist, wird der Wert von a zur Variablen
+<font face="Courier New"><b>product</b></font>
+addiert.
+</li>
+<li>
+Danach wird der Wert von
+a verdoppelt und der Wert von b halbiert (ohne Rest und
+ohne Rundung).
+</li>
+</ul>
+Diese beiden Schritte werden solange wiederholt, bis b durch die fortlaufende Halbierung den Wert 0
+annimmt. Die in <font face="Courier New"><b>product</b></font> gebildete Summe
+ist dann gleich dem Produkt von a
+und b. </li>
+
+<li>
+Hinweis: Realisieren Sie die Verdoppelung von a durch den Operator zur bitweisen
+Linksverschiebung <b><font face="Courier New"><<</font></b> und die Halbierung von b ohne Rest und Rundung durch
+den Operator zur bitweisen Rechtsverschiebung <b><font face="Courier New">>></font></b>. </li>
+
+<li>
+Schreiben Sie ein Programm, das zwei ganze Zahlen von der Tastatur einliest und
+das mit der Funktion <font face="Courier New"><b>multIterative</b></font>
+berechnete Produkt ausgibt. </li>
+
+<li>
+Schreiben Sie eine zweite Funktion <font face="Courier New"><b>multRecursive</b></font>,
+die die oben beschriebene Verdopplung, Halbierung und Summation durch rekursive
+Aufrufe von sich selbst realisiert. Testen Sie auch diese Funktion mit von der
+Tastatur eingegebenen Werten. </li>
+
+</ul>
+</td>
+</tr>
+</tbody></table>
+
+</body></html>
\ No newline at end of file diff --git a/Bachelor/Prog1/Prakt3/prg1p3_1/main.cpp b/Bachelor/Prog1/Prakt3/prg1p3_1/main.cpp new file mode 100644 index 0000000..9c84841 --- /dev/null +++ b/Bachelor/Prog1/Prakt3/prg1p3_1/main.cpp @@ -0,0 +1,65 @@ +// Programmieren 1, Praktikum 3, Aufgabe 1
+// Sven Eisenhauer
+// 12.11.2004
+//
+// file: main.cpp
+//
+// purpose: read 2 times (hours, minutes, seconds) from keyboard
+// calculate seconds between this two times
+// uses a function to convert times to seconds
+//
+//
+#include <iostream>
+using std::cin;
+using std::cout;
+using std::endl;
+
+int seconds(int, int, int);
+
+int main()
+{
+ int hours1,
+ minutes1,
+ seconds1,
+ totalSeconds1,
+ hours2,
+ minutes2,
+ seconds2,
+ totalSeconds2;
+
+ // read times from keyboard
+ cout << "Please enter 1st hours (0-24): ";
+ cin >> hours1;
+ cout << "Please enter 1st minutes (0-60): ";
+ cin >> minutes1;
+ cout << "Please enter 1st seconds (0-60): ";
+ cin >> seconds1;
+
+ cout << "Please enter 2nd hours (0-24): ";
+ cin >> hours2;
+ cout << "Please enter 2nd minutes (0-60): ";
+ cin >> minutes2;
+ cout << "Please enter 2nd seconds (0-60): ";
+ cin >> seconds2;
+
+ // convert to seconds
+ totalSeconds1=seconds(hours1,minutes1,seconds1);
+ totalSeconds2=seconds(hours2,minutes2,seconds2);
+
+ cout << endl << "Difference in seconds is: ";
+ // which is the bigger value and substract the lower one
+ if (totalSeconds1 > totalSeconds2)
+ cout << totalSeconds1 - totalSeconds2;
+ else
+ cout << totalSeconds2 - totalSeconds1;
+
+ cout << endl;
+
+ return 0;
+}// end main
+
+// function seconds
+int seconds (int h, int min, int sec)
+{
+ return h*3600+min*60+sec;
+} // end function seconds
\ No newline at end of file diff --git a/Bachelor/Prog1/Prakt3/prg1p3_1/prg1p3_1.dsp b/Bachelor/Prog1/Prakt3/prg1p3_1/prg1p3_1.dsp new file mode 100644 index 0000000..fc5a7cf --- /dev/null +++ b/Bachelor/Prog1/Prakt3/prg1p3_1/prg1p3_1.dsp @@ -0,0 +1,100 @@ +# Microsoft Developer Studio Project File - Name="prg1p3_1" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** NICHT BEARBEITEN **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=prg1p3_1 - Win32 Debug
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
+!MESSAGE
+!MESSAGE NMAKE /f "prg1p3_1.mak".
+!MESSAGE
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
+!MESSAGE
+!MESSAGE NMAKE /f "prg1p3_1.mak" CFG="prg1p3_1 - Win32 Debug"
+!MESSAGE
+!MESSAGE Für die Konfiguration stehen zur Auswahl:
+!MESSAGE
+!MESSAGE "prg1p3_1 - Win32 Release" (basierend auf "Win32 (x86) Console Application")
+!MESSAGE "prg1p3_1 - Win32 Debug" (basierend auf "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "prg1p3_1 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "prg1p3_1 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "prg1p3_1 - Win32 Release"
+# Name "prg1p3_1 - Win32 Debug"
+# Begin Group "Quellcodedateien"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\main.cpp
+# End Source File
+# End Group
+# Begin Group "Header-Dateien"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Ressourcendateien"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/Bachelor/Prog1/Prakt3/prg1p3_1/prg1p3_1.dsw b/Bachelor/Prog1/Prakt3/prg1p3_1/prg1p3_1.dsw new file mode 100644 index 0000000..4d304d8 --- /dev/null +++ b/Bachelor/Prog1/Prakt3/prg1p3_1/prg1p3_1.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
+
+###############################################################################
+
+Project: "prg1p3_1"=.\prg1p3_1.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/Bachelor/Prog1/Prakt3/prg1p3_2/main.cpp b/Bachelor/Prog1/Prakt3/prg1p3_2/main.cpp new file mode 100644 index 0000000..35796d5 --- /dev/null +++ b/Bachelor/Prog1/Prakt3/prg1p3_2/main.cpp @@ -0,0 +1,81 @@ +// Programmieren 1, Praktikum 3, Aufgabe 2
+// Sven Eisenhauer
+// 12.11.2004
+//
+// file: main.cpp
+//
+// purpose: roll 2 dice 6000 times and build a table, how often each possible sum occured
+//
+//
+//
+//
+#include <iostream>
+using std::cin;
+using std::cout;
+using std::endl;
+
+#include <ctime>
+#include <cstdlib>
+
+int rollDice(void);
+
+int main ()
+{
+ int stats[13] = {0};
+
+ srand(time(0));
+
+ for (int Counter=0;Counter <= 6000;Counter++)
+ {
+ /* switch (rollDice())
+ {
+ case 2:
+ stats[0]++;
+ break;
+ case 3:
+ stats[1]++;
+ break;
+ case 4:
+ stats[2]++;
+ break;
+ case 5:
+ stats[3]++;
+ break;
+ case 6:
+ stats[4]++;
+ break;
+ case 7:
+ stats[5]++;
+ break;
+ case 8:
+ stats[6]++;
+ break;
+ case 9:
+ stats[7]++;
+ break;
+ case 10:
+ stats[8]++;
+ break;
+ case 11:
+ stats[9]++;
+ break;
+ case 12:
+ stats[10]++;
+ break;
+ default:
+ cout << "Uuups... we should never get here...";
+ }*/
+ ++stats[rollDice()];
+ }
+ for (int i=2;i<=12;i++)
+ {
+ cout << endl << i << ": " << stats[i];
+ }
+ cout << endl;
+ return 0;
+}
+
+int rollDice(void)
+{
+ return (( 1 + (rand() % 6)) + ( 1 + (rand() % 6)));
+}
\ No newline at end of file diff --git a/Bachelor/Prog1/Prakt3/prg1p3_2/prg1p3_2.dsp b/Bachelor/Prog1/Prakt3/prg1p3_2/prg1p3_2.dsp new file mode 100644 index 0000000..2d4b338 --- /dev/null +++ b/Bachelor/Prog1/Prakt3/prg1p3_2/prg1p3_2.dsp @@ -0,0 +1,100 @@ +# Microsoft Developer Studio Project File - Name="prg1p3_2" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** NICHT BEARBEITEN **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=prg1p3_2 - Win32 Debug
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
+!MESSAGE
+!MESSAGE NMAKE /f "prg1p3_2.mak".
+!MESSAGE
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
+!MESSAGE
+!MESSAGE NMAKE /f "prg1p3_2.mak" CFG="prg1p3_2 - Win32 Debug"
+!MESSAGE
+!MESSAGE Für die Konfiguration stehen zur Auswahl:
+!MESSAGE
+!MESSAGE "prg1p3_2 - Win32 Release" (basierend auf "Win32 (x86) Console Application")
+!MESSAGE "prg1p3_2 - Win32 Debug" (basierend auf "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "prg1p3_2 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "prg1p3_2 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "prg1p3_2 - Win32 Release"
+# Name "prg1p3_2 - Win32 Debug"
+# Begin Group "Quellcodedateien"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\main.cpp
+# End Source File
+# End Group
+# Begin Group "Header-Dateien"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Ressourcendateien"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/Bachelor/Prog1/Prakt3/prg1p3_2/prg1p3_2.dsw b/Bachelor/Prog1/Prakt3/prg1p3_2/prg1p3_2.dsw new file mode 100644 index 0000000..332d7bf --- /dev/null +++ b/Bachelor/Prog1/Prakt3/prg1p3_2/prg1p3_2.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
+
+###############################################################################
+
+Project: "prg1p3_2"=.\prg1p3_2.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/Bachelor/Prog1/Prakt3/prg1p3_3/main.cpp b/Bachelor/Prog1/Prakt3/prg1p3_3/main.cpp new file mode 100644 index 0000000..c0c9cfc --- /dev/null +++ b/Bachelor/Prog1/Prakt3/prg1p3_3/main.cpp @@ -0,0 +1,57 @@ +// Programmieren 1, Praktikum 3, Aufgabe 3
+// Sven Eisenhauer
+// 17.11.2004
+//
+// file: main.cpp
+//
+// purpose: find "perfect numbers": The sum of all integer factors of a number is the number.
+//
+//
+#include <iostream>
+using std::cin;
+using std::cout;
+using std::endl;
+
+int isPerfect(int);
+
+int main()
+{
+ // how far to search
+ const int maxNumbers=1000;
+
+ for (int j=1;j<=maxNumbers;j++)
+ {
+ if (0 == isPerfect(j))
+ {
+ cout << ": " << j << endl;
+ }
+ }
+
+ cout << "\n";
+
+ return 0;
+}
+
+int isPerfect(int number)
+{
+ int sum=0;
+ // check for all numbers between the number, exclusive the number itself and 1 inclusive
+ for (int i=number-1;i>=1;i--)
+ {
+ // is the actual number a factor???
+ if (0 == number%i)
+ // if it is, add it
+ sum+=i;
+ }
+ // the sum of all factors... and so on
+ if (sum == number)
+ {
+ // so we have a perfect number here... fine... find the factors again and cout them
+ for (int k=number-1;k>=1;k--)
+ if (0 == number%k)
+ cout << k << " ";
+ return 0;
+ }
+ else
+ return 1;
+}
\ No newline at end of file diff --git a/Bachelor/Prog1/Prakt3/prg1p3_3/prg1p3_3.dsp b/Bachelor/Prog1/Prakt3/prg1p3_3/prg1p3_3.dsp new file mode 100644 index 0000000..0a8d693 --- /dev/null +++ b/Bachelor/Prog1/Prakt3/prg1p3_3/prg1p3_3.dsp @@ -0,0 +1,100 @@ +# Microsoft Developer Studio Project File - Name="prg1p3_3" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** NICHT BEARBEITEN **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=prg1p3_3 - Win32 Debug
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
+!MESSAGE
+!MESSAGE NMAKE /f "prg1p3_3.mak".
+!MESSAGE
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
+!MESSAGE
+!MESSAGE NMAKE /f "prg1p3_3.mak" CFG="prg1p3_3 - Win32 Debug"
+!MESSAGE
+!MESSAGE Für die Konfiguration stehen zur Auswahl:
+!MESSAGE
+!MESSAGE "prg1p3_3 - Win32 Release" (basierend auf "Win32 (x86) Console Application")
+!MESSAGE "prg1p3_3 - Win32 Debug" (basierend auf "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "prg1p3_3 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "prg1p3_3 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "prg1p3_3 - Win32 Release"
+# Name "prg1p3_3 - Win32 Debug"
+# Begin Group "Quellcodedateien"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\main.cpp
+# End Source File
+# End Group
+# Begin Group "Header-Dateien"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Ressourcendateien"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/Bachelor/Prog1/Prakt3/prg1p3_3/prg1p3_3.dsw b/Bachelor/Prog1/Prakt3/prg1p3_3/prg1p3_3.dsw new file mode 100644 index 0000000..fd4519a --- /dev/null +++ b/Bachelor/Prog1/Prakt3/prg1p3_3/prg1p3_3.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
+
+###############################################################################
+
+Project: "prg1p3_3"=.\prg1p3_3.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/Bachelor/Prog1/Prakt3/prg1p3_4/main.cpp b/Bachelor/Prog1/Prakt3/prg1p3_4/main.cpp new file mode 100644 index 0000000..d66c34c --- /dev/null +++ b/Bachelor/Prog1/Prakt3/prg1p3_4/main.cpp @@ -0,0 +1,43 @@ +// Programmieren 1, Praktikum 3, Aufgabe 4
+// Sven Eisenhauer
+// 17.11.2004
+//
+// file: main.cpp
+//
+// purpose: find the greatest common divisor of two numbers, recursive...
+//
+//
+
+#include <iostream>
+using std::cin;
+using std::cout;
+using std::endl;
+
+int gcd(int,int);
+
+int main()
+{
+ int number1,
+ number2;
+
+ cout << "1st number: ";
+ cin >> number1;
+ cout << "2nd number: ";
+ cin >> number2;
+
+ cout <<endl<<"Greatest common divisor: "<< gcd(number1,number2) << endl;
+
+ return 0;
+}
+
+int gcd(int x, int y)
+{
+ if (0 == y)
+ {
+ return x;
+ }
+ else
+ {
+ return gcd (y,x%y);
+ }
+}
\ No newline at end of file diff --git a/Bachelor/Prog1/Prakt3/prg1p3_4/prg1p3_4.dsp b/Bachelor/Prog1/Prakt3/prg1p3_4/prg1p3_4.dsp new file mode 100644 index 0000000..39e531b --- /dev/null +++ b/Bachelor/Prog1/Prakt3/prg1p3_4/prg1p3_4.dsp @@ -0,0 +1,100 @@ +# Microsoft Developer Studio Project File - Name="prg1p3_4" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** NICHT BEARBEITEN **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=prg1p3_4 - Win32 Debug
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
+!MESSAGE
+!MESSAGE NMAKE /f "prg1p3_4.mak".
+!MESSAGE
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
+!MESSAGE
+!MESSAGE NMAKE /f "prg1p3_4.mak" CFG="prg1p3_4 - Win32 Debug"
+!MESSAGE
+!MESSAGE Für die Konfiguration stehen zur Auswahl:
+!MESSAGE
+!MESSAGE "prg1p3_4 - Win32 Release" (basierend auf "Win32 (x86) Console Application")
+!MESSAGE "prg1p3_4 - Win32 Debug" (basierend auf "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "prg1p3_4 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "prg1p3_4 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "prg1p3_4 - Win32 Release"
+# Name "prg1p3_4 - Win32 Debug"
+# Begin Group "Quellcodedateien"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\main.cpp
+# End Source File
+# End Group
+# Begin Group "Header-Dateien"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Ressourcendateien"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/Bachelor/Prog1/Prakt3/prg1p3_4/prg1p3_4.dsw b/Bachelor/Prog1/Prakt3/prg1p3_4/prg1p3_4.dsw new file mode 100644 index 0000000..3b1991e --- /dev/null +++ b/Bachelor/Prog1/Prakt3/prg1p3_4/prg1p3_4.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
+
+###############################################################################
+
+Project: "prg1p3_4"=.\prg1p3_4.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/Bachelor/Prog1/Prakt3/prg1p3_5/main.cpp b/Bachelor/Prog1/Prakt3/prg1p3_5/main.cpp new file mode 100644 index 0000000..03c35e7 --- /dev/null +++ b/Bachelor/Prog1/Prakt3/prg1p3_5/main.cpp @@ -0,0 +1,67 @@ +// Programmieren 1, Praktikum 3, Aufgabe 5
+// Sven Eisenhauer
+// 17.11.2004
+//
+// file: main.cpp
+//
+// purpose: egypt multiplication
+//
+//
+#include <iostream>
+using std::cin;
+using std::cout;
+using std::endl;
+
+int multIterative(int,int);
+void multRecursive(int,int, int &);
+
+int main()
+{
+ int number1,
+ number2,
+ erg;
+
+ cout << "1st number: ";
+ cin >> number1;
+ cout << "2nd number: ";
+ cin >> number2;
+
+ cout << "Product: " << multIterative(number1,number2) << endl;
+ multRecursive(number1,number2,erg);
+ cout << "Product: " << erg << endl;
+
+ return 0;
+}
+
+int multIterative(int a,int b)
+{
+ int product=0;
+ while (b>0)
+ {
+ if (0 != b%2)
+ product+=a;
+
+ a = a << 1;
+ b = b >> 1;
+ }
+ return product;
+}
+
+void multRecursive(int a,int b, int &product)
+{
+ int x,y;
+
+ if (b<=1)
+ product=a;
+
+ else
+ {
+ x=a<<1;
+ y=b>>1;
+ multRecursive(x,y,product);
+ if (0!=b%2)
+ product+=a;
+
+ }
+
+}
\ No newline at end of file diff --git a/Bachelor/Prog1/Prakt3/prg1p3_5/prg1p3_5.dsp b/Bachelor/Prog1/Prakt3/prg1p3_5/prg1p3_5.dsp new file mode 100644 index 0000000..5344ee4 --- /dev/null +++ b/Bachelor/Prog1/Prakt3/prg1p3_5/prg1p3_5.dsp @@ -0,0 +1,100 @@ +# Microsoft Developer Studio Project File - Name="prg1p3_5" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** NICHT BEARBEITEN **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=prg1p3_5 - Win32 Debug
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
+!MESSAGE
+!MESSAGE NMAKE /f "prg1p3_5.mak".
+!MESSAGE
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
+!MESSAGE
+!MESSAGE NMAKE /f "prg1p3_5.mak" CFG="prg1p3_5 - Win32 Debug"
+!MESSAGE
+!MESSAGE Für die Konfiguration stehen zur Auswahl:
+!MESSAGE
+!MESSAGE "prg1p3_5 - Win32 Release" (basierend auf "Win32 (x86) Console Application")
+!MESSAGE "prg1p3_5 - Win32 Debug" (basierend auf "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "prg1p3_5 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "prg1p3_5 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "prg1p3_5 - Win32 Release"
+# Name "prg1p3_5 - Win32 Debug"
+# Begin Group "Quellcodedateien"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\main.cpp
+# End Source File
+# End Group
+# Begin Group "Header-Dateien"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Ressourcendateien"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/Bachelor/Prog1/Prakt3/prg1p3_5/prg1p3_5.dsw b/Bachelor/Prog1/Prakt3/prg1p3_5/prg1p3_5.dsw new file mode 100644 index 0000000..6fd9859 --- /dev/null +++ b/Bachelor/Prog1/Prakt3/prg1p3_5/prg1p3_5.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
+
+###############################################################################
+
+Project: "prg1p3_5"=.\prg1p3_5.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
|
