diff options
Diffstat (limited to 'Bachelor/Prog1/Prakt3/prg1p3_2')
| -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 |
3 files changed, 210 insertions, 0 deletions
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>
+{{{
+}}}
+
+###############################################################################
+
|
