Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Lerntagbuch Hussam Moammar 1548394
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hussam Moammar
Lerntagbuch Hussam Moammar 1548394
Commits
abf9692b
Commit
abf9692b
authored
4 months ago
by
Hussam Moammar
Browse files
Options
Downloads
Patches
Plain Diff
Edit Woche 13.md
parent
52c90814
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Woche 13.md
+79
-0
79 additions, 0 deletions
Woche 13.md
with
79 additions
and
0 deletions
Woche 13.md
+
79
−
0
View file @
abf9692b
...
...
@@ -58,4 +58,83 @@ Ziel: Berechnung des Medians
## 8. Erneut kompilieren und ausführen
1.
Wiederholen Sie die Schritte 4 bis 6, um die Änderungen zu übernehmen und sicherzustellen, dass die Zufallszahlen sich bei jedem Start ändern.
## Antwort
### **1. Vorbereitung**
-
Projekt:
**The Algorithms (C)**
-
Ziel: Medianberechnung
-
Repository:
[
https://github.com/TheAlgorithms/C
](
https://github.com/TheAlgorithms/C
)
-
Struktur: Die Datei
`median.c`
befindet sich in einem der Unterverzeichnisse.
---
### **2. Projekt klonen**
```
sh
git clone https://github.com/TheAlgorithms/C.git
cd
C
```
---
### **3. Datei finden**
```
sh
find ./
-name
"median.c"
```
-
Ausgabe zeigt den Speicherort der Datei.
---
### **4. Datei kompilieren**
```
sh
cd
<Pfad zu median.c>
gcc
-o
median median.c
```
---
### **5. Rechte anpassen**
```
sh
chmod
755 median
```
---
### **6. Ausführen**
```
sh
./median
```
-
Beobachtung: Die Ausgabe bleibt bei jedem Lauf gleich.
---
### **7. Quellcode anpassen**
**Datei `median.c` öffnen und bearbeiten:**
-
**Zeitbibliothek einfügen:**
```
c
#include
<time.h>
```
-
**Zufallszahlengenerator im `main`-Aufruf initialisieren:**
```
c
srand
(
time
(
NULL
));
```
---
### **8. Erneut kompilieren und ausführen**
```
sh
gcc
-o
median median.c
chmod
755 median
./median
```
-
Jetzt ändern sich die Zufallszahlen bei jedem Lauf.
---
### **Erkenntnisse:**
-
`git clone`
lädt das gesamte Projekt.
-
`find`
hilft, bestimmte Dateien schnell zu lokalisieren.
-
`gcc`
kompiliert C-Code in eine ausführbare Datei.
-
`chmod 755`
setzt Ausführungsrechte.
-
`srand(time(NULL))`
sorgt für unterschiedliche Zufallszahlen.
---
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment