Das neue Auswendig lernen und die neuen Übungen - 0003

Benutzeravatar
davidvajda.de
Site Admin
Beiträge: 1488
Registriert: Di Jul 18, 2023 8:36 pm
Wohnort: D-72072, Tübingen
Kontaktdaten:

Re: Das neue Auswendig lernen und die neuen Übungen - 0003

Beitrag von davidvajda.de »

Bild

Code: Alles auswählen

<?php
session_start ();

?>

<form method="POST" action="./form20240330.php">
<input type="text" name="form20240330a"></input>
<input type="submit">
</form>


<?php
setcookie ("form20240330b", "Ich bin das erste Cookie", time () + 1200);

echo session_id () . "<br>\n";

echo htmlentities ($_POST ["form20240330a"]) . "<br>\n";
echo htmlentities ($_COOKIE ["form20240330b"]) . "<br>\n";
echo htmlentities ($_COOKIE ["form20240330c"]) . "<br>\n";

session_destroy ();
?>

Code: Alles auswählen

POST http://localhost/mysql20240217/20240330/form20240330.php HTTP/1.1
host: localhost
Cookie: form20240330c=Hallo, ich bin das Alternative Cookie
Content-Length: 31
Content-Type: application/x-www-form-urlencoded

form20240330a=Ich bin das Datum

Code: Alles auswählen

Trying ::1...
Connected to localhost.
Escape character is '^]'.
HTTP/1.1 200 OK
Date: Sat, 30 Mar 2024 14:44:04 GMT
Server: Apache/2.4.57 (Debian)
Set-Cookie: PHPSESSID=psmr1o2a8ecsel1qrc3ke3su43; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: form20240330b=Ich%20bin%20das%20erste%20Cookie; expires=Sat, 30 Mar 2024 15:04:04 GMT; Max-Age=1200
Vary: Accept-Encoding
Content-Length: 231
Content-Type: text/html; charset=UTF-8


<form method="POST" action="./form20240330.php">
<input type="text" name="form20240330a"></input>
<input type="submit">
</form>


psmr1o2a8ecsel1qrc3ke3su43<br>
Ich bin das Datum<br>
<br>
Hallo, ich bin das Alternative Cookie<br>

Code: Alles auswählen

<?php
session_start ();

include ("/home/david/mysqldata.php");

$db = new PDO ("mysql: host=localhost", $MYSQL_USER, $MYSQL_PASSWORD);

$sql = "CREATE DATABASE mysql20240330" . session_id () . "; ";
$db -> query ($sql);

$sql = "USE mysql20240330" . session_id () . "; ";
$db -> query ($sql);

$sql = "CREATE TABLE a (x1 INTEGER, x2 INTEGER); CREATE TABLE b (y1 INTEGER, y2 INTEGER); ";
$db->query ($sql);

$sql = "INSERT INTO a (x1, x2) VALUES (0, 0); ";
$db->query ($sql);

$sql = "INSERT INTO a (x1, x2) VALUES (0, 1); ";
$db->query ($sql);

$sql = "INSERT INTO a (x1, x2) VALUES (1, 0); ";
$db->query ($sql);

$sql = "INSERT INTO a (x1, x2) VALUES (1, 1); ";
$db->query ($sql);

$sql = "INSERT INTO a (x1, x2) VALUES (2, 7); ";
$db->query ($sql);

$sql = "INSERT INTO b (y1, y2) VALUES (0, 1); ";
$db->query ($sql);

$sql = "INSERT INTO b (y1, y2) VALUES (1, 0); ";
$db->query ($sql);

$sql = "INSERT INTO b (y1, y2) VALUES (2, 7); ";
$db->query ($sql);

$sql = "SELECT x1, x2 FROM a; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
    echo $row [0] . ", " . $row [1] . "<br>\n";
echo "<br>\n";

$sql = "SELECT y1, y2 FROM b; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
    echo $row [0] . ", " . $row [1] . "<br>\n";
echo "<br>\n";

$sql = "SELECT x1, x2, y1, y2 FROM a INNER JOIN b ON a.x2 = b.y2; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
    echo $row [0] . ", " . $row [1] . ", " . $row [2] . ", " . $row [3] . "<br>\n";
echo "<br>\n";


$sql = "DROP DATABASE mysql20240330" . session_id () . "; ";
$db -> query ($sql);

session_destroy ();
?>

Code: Alles auswählen

0, 0<br>
0, 1<br>
1, 0<br>
1, 1<br>
2, 7<br>
<br>
0, 1<br>
1, 0<br>
2, 7<br>
<br>
0, 0, 1, 0<br>
0, 1, 0, 1<br>
1, 0, 1, 0<br>
1, 1, 0, 1<br>
2, 7, 2, 7<br>
<br>

Code: Alles auswählen

<?php
session_start ();

include ("/home/david/mysqldata.php");

$db = new PDO ("mysql: host=localhost", $MYSQL_USER, $MYSQL_PASSWORD);

$sql = "CREATE DATABASE quantity20240330" . session_id () . "; ";
$db->query ($sql);


$sql = "USE quantity20240330" . session_id () . "; ";
$db->query ($sql);

$sql = "CREATE TABLE a (x INTEGER); CREATE TABLE b (x INTEGER); CREATE TABLE c (x INTEGER); ";
$db->query ($sql);

for ($i = 0;  $i < 14;  $i++) {
    $sql = "INSERT INTO a (x) VALUES (" . rand () % 12 . "); ";
    $sql .= "INSERT INTO b (x) VALUES (" . rand () % 16 . "); ";
    $sql .= "INSERT INTO c (x) VALUES (" . rand () % 32 . "); ";
    $db->query ($sql);
}

$sql = "SELECT x FROM (SELECT x FROM a UNION SELECT x FROM b) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
    echo $row [0] . ", ";
echo "; <br>\n";

$sql = "SELECT x FROM (SELECT x FROM a UNION SELECT x FROM c) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
    echo $row [0] . ", ";
echo "; <br>\n";

$sql = "SELECT x FROM (SELECT x FROM b UNION SELECT x FROM c) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
    echo $row [0] . ", ";
echo "; <br>\n";

$sql = "SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM b) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
    echo $row [0] . ", ";
echo "; <br>\n";

$sql = "SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM c) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
    echo $row [0] . ", ";
echo "; <br>\n";

$sql = "SELECT x FROM (SELECT x FROM b INTERSECT SELECT x FROM c) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
    echo $row [0] . ", ";
echo "; <br>\n";

$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM a UNION SELECT x FROM b) x
                INTERSECT
            SELECT x FROM c
    ) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
    echo $row [0] . ", ";
echo "; <br>\n";

$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM c) x
                UNION
            SELECT x FROM (SELECT x FROM b INTERSECT SELECT x FROM c) x
    ) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
    echo $row [0] . ", ";
echo "; <br>\n";

$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM a UNION SELECT x FROM c) x
                INTERSECT
            SELECT x FROM b
    ) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
    echo $row [0] . ", ";
echo "; <br>\n";

$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM b) x
                UNION
            SELECT x FROM (SELECT x FROM c INTERSECT SELECT x FROM c) x
    ) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
    echo $row [0] . ", ";
echo "; <br>\n";

$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM b UNION SELECT x FROM c) x
                INTERSECT
            SELECT x FROM a
    ) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
    echo $row [0] . ", ";
echo "; <br>\n";

$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM b) x
                UNION
            SELECT x FROM (SELECT x FROM b INTERSECT SELECT x FROM c) x
    ) x; ";
$stmt = $db->query ($sql);
while ($row = $stmt -> fetch ())
    echo $row [0] . ", ";
echo "; <br>\n";

$sql = "DROP DATABASE quantity20240330" . session_id () . "; ";
$db->query ($sql);

session_destroy ();
?>

Code: Alles auswählen

6, 1, 2, 8, 0, 3, 7, 11, 9, 5, 4, 15, 10, ; <br>
6, 1, 2, 8, 0, 3, 7, 11, 9, 16, 18, 22, 14, 26, 25, 20, 28, 29, 27, ; <br>
0, 11, 5, 6, 4, 9, 15, 10, 8, 1, 16, 18, 22, 14, 26, 7, 25, 20, 28, 29, 27, ; <br>
6, 1, 8, 0, 11, 9, ; <br>
1, 8, 0, 7, ; <br>
0, 8, 1, ; <br>
1, 8, 0, 7, ; <br>
1, 8, 0, 7, ; <br>
6, 1, 8, 0, 11, 9, ; <br>
6, 1, 8, 0, 11, 9, 16, 18, 22, 14, 26, 7, 25, 20, 28, 29, 27, ; <br>
0, 11, 6, 9, 8, 1, 7, ; <br>
6, 1, 8, 0, 11, 9, ; <br>

Code: Alles auswählen

#!/bin/bash

if [[ "$1" == "David" && "$2" == "Vajda" ]]
then
    echo "Hallo, das bin ich"
elif [[ "$1" == "David Vajda" && -z "$2" ]]
then
    echo "Hallo, das bin ich"
elif [[ "$1" == "David" && -z "$2" ]]
then
    echo "Ich könnte es sein"
elif [[ "$1" == "Vajda" && -z "$2" ]]
then
    echo "Ich könnte es sein"
elif [ -n "$1" ]
then
    echo "Das bin ich nicht"
else
    echo "Hallo Welt"
    echo "\#\!\/bin\bash"
    i=0
    while [ $i -lt 10 ]
    do
        echo "Hallo zum $(($i+1))."
        i=$(($i+1))
    done
    a=(Super sache sage ich)
    a+=(Ich nämlich auch)
    i=0
    while [ $i -lt 7 ]
    do
        echo "${a[$i]}"
        i=$(($i+1))
    done
    for s in "${a[@]}"
    do
        echo "$s"
    done
    l=$(ls)
    for s in $l
    do
        echo "$s"
    done
fi

Code: Alles auswählen

#!/bin/bash

/bin/bash bash20240330.sh David Vajda
/bin/bash bash20240330.sh "David Vajda"
/bin/bash bash20240330.sh "David"
/bin/bash bash20240330.sh "Vajda"
/bin/bash bash20240330.sh "David" "Mustermann"
/bin/bash bash20240330.sh "Max Mustermann"
/bin/bash bash20240330.sh

Code: Alles auswählen

Hallo, das bin ich
Hallo, das bin ich
Ich könnte es sein
Ich könnte es sein
Das bin ich nicht
Das bin ich nicht
Hallo Welt
\#\!\/bin\bash
Hallo zum 1.
Hallo zum 2.
Hallo zum 3.
Hallo zum 4.
Hallo zum 5.
Hallo zum 6.
Hallo zum 7.
Hallo zum 8.
Hallo zum 9.
Hallo zum 10.
Super
sache
sage
ich
Ich
nämlich
auch
Super
sache
sage
ich
Ich
nämlich
auch
1-clustering.pdf
a01.sql
a02.sql
a03.sql
a04.sql
a05.sql
a06.sql
a07.sql
a08.sql
abschlussecefd7f6-ac32-4ad3-a269-a83fee06cc2c.jpg
abschlussecefd7f6-ac32-4ad3-a269-a83fee06cc2c.pdf
addressdecodertestbench.c
alldo.txt
alllinks.sh
Andrew
S.
Tanenbaum
-
Betriebssysteme2.pdf
a.out
asm15
asm16
asm20240313.asm
asm20240313.o
asm20240322
asm20240322.asm
asm20240322cpuid
asm20240322cpuid.asm
asm20240322cpuid.o
asm20240322mmx
asm20240322mmx.asm
asm20240322mmx.o
asm20240322.o
asm20240324-1.jpg
asm20240324.aux
asm20240324.log
asm20240324.pdf
asm20240324.tex
auswendig20240320a.txt
auswendig20240320b.txt
auswendig20240320c.txt
auswendig20240321a.txt
auswendig20240321b.txt
auswendig20240321c.txt
auswendig20240322a.txt
auswendig20240322b.txt
auswendig20240322c.txt
auswendig20240322d.txt
auswendig20240322e.txt
auswendig20240323a.txt
auswendig20240323b.txt
auswendig20240323c.txt
auswendig20240324a.txt
auswendig20240324b.txt
auswendig20240324c.txt
auswendig20240326a.txt
auswendig20240326b.txt
auswendig20240327a.txt
auswendig20240327b.txt
auswendig20240330a.txt
auswendig20240330b.txt
auswendig20240330c.txt
auswendig20240330d.txt
auswendig20240330e.txt
automat15
automat15.c
automat20240324-1.jpg
automat20240324.aux
automat20240324.csv
automat20240324.ctxt
automat20240324.log
automat20240324.pdf
automat20240324.tex
automat20240324.txt
bash2020330
bash20240322.out
bash20240322.sh
bash20240330all.out
bash20240330all.sh
bash20240330.out
bash20240330.sh
Bilder
bin20240322.txt
binary2
binary2.c
binomialkoeffizient.asm
cpuid001.asm
cpuid001.o
davidvajda_dephpbb3.sql
debian-12.5.0-amd64-netinst.iso
decrypted20240322.txt
deepsearch1.c
deepsearch2
deepsearch2.c
doc
Dokumente
dos-inst
Downloads
encoded20240322.txt.asc
facebookpassword.txt
files.lst
float.c
fsmprogs
generatetestbench2
generatetestbench3
generatetestbench4
generatetestbench5
gnu-hello
gpgprotokoll20240322.txt
ieee754aufgabe
ieee754aufgabe.c
ieee754aufgabe.o
imgout.txt
inst
Installationsassistent.pdf
ituenix_dephpbb3a.sql
ituenix_dephpbb3b.sql
k.jpg
klartext20240322.txt
klartext20240322.txt.asc
kombinatorik.txt
Kor_7828020_063013-01.jpg
Kor_7828020_063013-02.jpg
Kor_7828020_063013-03.jpg
Kor_7828020_063013-04.jpg
Kor_7828020_063013-05.jpg
Kor_7828020_063013-06.jpg
Kor_7828020_063013-07.jpg
Kor_7828020_063013-08.jpg
Kor_7828020_063013-09.jpg
Kor_7828020_063013-10.jpg
Kor_7828020_063013-11.jpg
Kor_7828020_063013-12.jpg
Kor_7828020_063013-13.jpg
Kor_7828020_063013-14.jpg
Kor_7828020_063013-15.jpg
Kor_7828020_063013-16.jpg
Kor_7828020_063013-17.jpg
Kor_7828020_063013-18.jpg
Kor_7828020_063013-19.jpg
Kor_7828020_063013-20.jpg
Kor_7828020_063013-21.jpg
Kor_7828020_063013-22.jpg
Kor_7828020_063013-23.jpg
Kor_7828020_063013-24.jpg
Kor_7828020_063013-25.jpg
Kor_7828020_063013-26.jpg
Kor_7828020_063013-27.jpg
Kor_7828020_063013-28.jpg
Kor_7828020_063013.pdf
mail
Makefile
makefile20240322cpuid
makefile20240322mmx
Mars
matlab
minix20240327.txt
mips32singlecycle2.vhdl
mips32singlecycle.vhdl
mmx001.asm
mörder.txt
multdiv.c
Musik
mysqldata.php
names.txt
node_modules
Öffentlich
Open-Web-Analytics-1.7.8.zip
Open-Web-Analytics-master.zip
out.txt
owa-php-sdk-master.zip
package-tools-master.zip
password
password20240326.txt
password46.txt
pc.txt
prestashop_edition_basic_version_8.1.4.zip
quine
quine20240323.txt
quine20240323.vhdl
replace.sh
savesql.txt
save.txt
Schreibtisch
Screenshot_20240319_055421.png
Screenshot_20240319_162029.png
Screenshot_20240319_163720.png
Screenshot_20240319_163922.png
Screenshot_20240319_170825.png
Screenshot_20240319_171639.png
Screenshot_20240319_183417.png
Screenshot_20240319_183434.png
Screenshot_20240319_183448.png
Screenshot_20240319_183456.png
Screenshot_20240319_183504.png
Screenshot_20240319_192644.png
Screenshot_20240319_200753.png
Screenshot_20240320_122854.png
Screenshot_20240321_060641.png
Screenshot_20240321_060820.png
Screenshot_20240322_170446.png
Screenshot_20240322_172918.png
Screenshot_20240322_175448.png
Screenshot_20240323_160210.png
Screenshot_20240323_182557.png
Screenshot_20240323_190651.png
Screenshot_20240323_201906.png
Screenshot_20240323_202053.png
Screenshot_20240324_180650.png
Screenshot_20240324_191756.png
Screenshot_20240330_153647.png
seopanel.v.4.10.0.zip
state20240324.txt
state3
svg
test.png.vcd
todo2.txt
todo.txt
Videos
VirtualBox
VMs
Vorlagen
wave.ghw
work-obj93.cf

Code: Alles auswählen

# Keine Sorge, ich habe gestern nicht nichts gemacht, ich habe dieses initscript versucht zu installiere
# Leider ist das bei mir mit der Installation von initscripten immer eine glücksache. Semantisch ist es sicher richtig. Es ist immer glücksache, ich sass mehere Stunden da und habe probiert es zu installieren. Ging nicht. 

#!/bash/bash
#
# mydamond initscripts
#
### BEGIN INIT INFO
# Provides:         echo
# Required-Start:
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: This is a test daemon
# Description: This is a test daemon
### END INIT INFO

case "$1" in
    start)
            echo "Hallo Welt"
        ;;
    stop)
            echo "Bis zum naechsten Mal"
        ;;
    reload)
            echo "Bis gleich"
        ;;
    *)
            echo "Eingabefehler"
        ;;
esac
exit 0

Code: Alles auswählen

pushfd
pop eax
mov ebx, eax

pushfd
pop eax
mov ebx, eax

pushfd
pop eax
mov ebx, eax

pushfd
pop eax
mov ebx, eax

pushfd
pop eax
mov ebx, eax

xor eax, 00200000h
xor eax, 00200000h
xor eax, 00200000h

pushfd
pop eax
mov ebx, eax
xor eax, 00200000h

pushfd
pop eax
mov ebx, eax
xor eax, 00200000h

pushfd
pop eax
mov ebx, eax
xor eax, 00200000h

push eax
popfd
pop eax

push eax
popfd
pop eax

push eax
popfd
pop eax

pushfd
pop eax
mov ebx, eax
xor eax, 00200000h
push eax
popfd
pop eax

push eax
popfd
pop eax

xor eax, ebx
jnz vorhanden

xor eax, ebx
jnz vorhanden

xor eax, ebx
jnz vorhanden

xor eax, ebx
jnz vorhanden

Funktionsnummer 0
Funktionsnummer 0
funktionsnummer 0, eax, ebx, ecx, edx
Funktionsnummer 0, eax, ebx, ecx, edx
Funktionsnummer 0, eax, ebx, ecx, edx

eax: Maximale Funktionsnummer 1h, 2h, 3h
eax: Maximale Funktonsnumm: 1h, 2h, 3h
eax: Maximale Funktionummer: 1h, 2h, 3h
eeax: Maximale Funktionsnummer: 1h, 2h, 3h

ebx: "Genu"
ebx: "Genu"
ebx: "Genu"
ebx: "Genu"
ebx: "Genu"
ecx: "ntel"
ecx: "ntel"
ecx: "ntel"
edx: "inel"
edx: "inel"
edx: "inel"

1h, eax: Bit 4 - 7 Modellnummer
1h, eax: Bit 4 - 7 Modellnummer
1h, eax: Bit 4 - 7 Modellnummmer

FPU, VME, FPU, VME, FPU, VME, FPU, VME, FPU, VME
DE, PSE, DE, PSE, DE, PSE
TSC, MSR, TSC, MSR, TSC, MSR, TSC, MSR
PAE, MCE, PAE, MCE, PAE, MCE, PAE, MCE
APIC, SEP, APIC, SEP, APIC, SEP, APIC, SEP
CX8, CX8, CX8, CX8
MTTR, MCA, MTTR, MCA, MTTR, MCA
CMOV, PAI, CMOV, PAI, CMOV, PAI
PSE-36, PSE-36, PSE-36, PSE-36
PSN, CLFSH, PSN, CLFSH, PSN, CLSFS
DS, ACPI, DS, ACPI
MMX, SSE, SSE2

APIC, PAE, PSE, FPU, VME, PSE-36, MMX, SSE, SSE2
APIC, PAE, PSE, FPU, VME, PSE-36, MMX, SSE, SSE2
APIC, PAE, PSE, FPU, VME, PSE-36, MMX, SEE, SSE2
Also, als nächstes Baue ich eine Schaltung - die Aufgabe mit dem gpg, vgcreate, luks, cryptsetup, kommt danach. Später per Hand Rechnen, VHDL, Automat, Mealy und Moore, komplexes Schaltwerk und so weiter.

Ich baue aber zunächst Schaltungen. Natürlich die mit dem NE555. Ich werde das ganze aber ergänzen, um eine Schaltung, die ich zunächst baue, mit einem Transistor. Ich nehme einen BC548. Ich werde 5V verwenden und einen Arbeitspunkt herstellen. Experimenthalber mit Widerständen von 330 Ohm, und sogar 100 Ohm, bis mehrere Kilo Ohm. Ich nehme, das Signal für Kopfhörer, verstärke es und schicke es in einen Lautsprecher

Ich ergänze die Schaltung - ich werde gleichzeitig zum Lautsprecher noch eine LED mit Widerstand nehmen. So wird die LED so flackern, wie der Lautsprecher Töne von sich gibt

Zunächst zeichne ich einen Schaltplan.


Bild

Gut, ich baue die Schaltung gleich, zur Entspannung, mache ich eine andere Aufgabe, ich mache die schriftlichen Rechnungen, erst.

Code: Alles auswählen

// So, ich habe hier ja die Aufgabe für das IEEE754

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main (void) {
    time_t t;
    int n;
    float f1 = 1;
    float f2;


    srand ((unsigned )time (&t));

    f2 = (float) (rand () % (8192 * 4));

    n = (rand () % 8) + 2;

    while (n > 0) {
        f1 = f1 / 2;
        n--;
    }

    f2 = f2 + f1;

    printf ("Rechne die Zahl in IEEE-754 um %f\n", f2);


return 0;
}

/* Die Aufgabe, hat so einen Nachteil - sie hat bei dem Komma, am Anfang immer nullen, die muss ich beseitigen */

/* Dazu arbeite ich noch an den Programm */
Ich mache das so - dass ich die 1 entsprechend durch 10 teile. Und, für jeden Teilung und das entsprechende, was für jeden Teilung durch 10 geteilt wurde, multipliziere ich mit einer Ziffer - von 1 bis 9 und addiere dieses Ergebnis zu den Ziffern hinter dem Komma.

Code: Alles auswählen

// so, das sieht besser aus

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main (void) {
    time_t t;
    int n;
    float f1 = 1;
    float f2;
    float f3 = 100;
    float f4 = 0;

    srand ((unsigned )time (&t));

    f2 = (float) (rand () % (8192 * 4));

    n = (rand () % 8) + 2;

    while (n > 0) {
        f1 = f1 / 2;
        f3 = f3 / 10;
        f4 = f4 + (f3 * (rand () % 10));
        n--;
    }

    f2 = f2 + f1 + f4;

    printf ("Rechne die Zahl in IEEE-754 um %f\n", f2);

return 0;
}

Code: Alles auswählen

# Hier sind die Testergebnisse

Rechne die Zahl in IEEE-754 um 7380.961914
Rechne die Zahl in IEEE-754 um 534.092529
Rechne die Zahl in IEEE-754 um 27005.724609
Rechne die Zahl in IEEE-754 um 399.536255
Rechne die Zahl in IEEE-754 um 24792.250000
Rechne die Zahl in IEEE-754 um 2672.447510
Rechne die Zahl in IEEE-754 um 19496.250000
Rechne die Zahl in IEEE-754 um 9088.525391
Rechne die Zahl in IEEE-754 um 22100.964844
Rechne die Zahl in IEEE-754 um 20411.250000

Code: Alles auswählen


# Damit habe ich es getestet

#!/bin/bash

i=0

while [ $i -lt 10 ]
do
    ./ieee754aufgabe
    sleep 1
    i=$(($i+1))
done
Das ist interessant, das Testprogramm, von gerade eben scheint kein Ende zu nehmen, weil - es dauert 10s. Wegen dem sleep 1. Es braucht das sleep 1 allerdings, weil - wenn das Programm innerhalb von einer Sekunde noch mal ausgeführt wird, liefert es das gleiche Ergebnis. Weil - der Witz ist - dass es Zufallszahlen benutzt und die hängen von der Sekunde ab. Dann liefert es das gleiche Ergebnis


Bild

Code: Alles auswählen

1.) Rechne die Zahl in binaer Darstellung  in eine Dezimale Darstellung um
0001100101001100b 6476d
2.) Rechne die Zahl in dezimal darstellung in eine Binaerdarstellung um
39830 1001101110010110
3.) Addiere die drei Zahlen schriftlich
            49301
+            7729
+           58898
-----------------
           115928
4.) Subtrahiere die letzten drei Zahlen schriftlich von der ersten schriftlich
            34300
-           15010
-            8840
-           16309
-----------------
            -5859
5.) Rechne die Zahl ins zweier komplement um, mit 8 Bit - und subtrahiere diese zahl von der ersten und rechne das Ergebnis nach dezimal
-77 -9 = -86
10110011 11110111 = 10101010
6.) Multipliziere die zwei Zahlen schriftlich
23195*45453 = 1054282335
7.) Dividiere die zwei Zahlen schriftlich
2728/55250 = 0
8.) Errechne x Logarithmisch mit dem Taschenrechner
2771^x = 134648604
Rechne die Zahl in IEEE-754 um 30446.796875

Bild

Bild

Bild

Bild

Bild

Bild

Code: Alles auswählen

 0 0 0 0 0    0
 1 0 0 0 1    1
 2 0 0 1 0    1
 3 0 0 1 1    0
 4 0 1 0 0    1
 5 0 1 0 1    0
 6 0 1 1 0    1
 7 0 1 1 1    1
 8 1 0 0 0    1
 9 1 0 0 1    0
10 1 0 1 0    1
11 1 0 1 1    1
12 1 1 0 0    1
13 1 1 0 1    0
14 1 1 1 0    1
15 1 1 1 1    1


 1 0 0 0 1    1
 2 0 0 1 0    1
 4 0 1 0 0    1
 6 0 1 1 0    1
 7 0 1 1 1    1
 8 1 0 0 0    1
10 1 0 1 0    1
11 1 0 1 1    1
12 1 1 0 0    1
14 1 1 1 0    1
15 1 1 1 1    1



Gruppe 1:
 1 0 0 0 1    1
 2 0 0 1 0    1
 4 0 1 0 0    1
 8 1 0 0 0    1
Gruppe 2:
 6 0 1 1 0    1
10 1 0 1 0    1
12 1 1 0 0    1
Gruppe 3:
 7 0 1 1 1    1
11 1 0 1 1    1
14 1 1 1 0    1
Gruppe 4:
15 1 1 1 1    1



Gruppe 1:
 1 0 0 0 1    1
 2 0 0 1 0    1
 4 0 1 0 0    1
 8 1 0 0 0    1
Gruppe 2:
 6 0 1 1 0    1
10 1 0 1 0    1
12 1 1 0 0    1
Gruppe 3:
 7 0 1 1 1    1
11 1 0 1 1    1
14 1 1 1 0    1
Gruppe 4:
15 1 1 1 1    1

1           0 0 0 1
2:6         0 - 1 0
2:10        - 0 1 0
4:6         0 1 - 0
4:12        - 1 0 0
8:10        1 0 - 0
8:12        1 - 0 0
6:7         0 1 1 -
6:14        - 1 1 0
10:11       1 0 1 -
10:14       1 - 1 0
12:!4       1 1 - 0
7:15        - 1 1 1
11:15       1 - 1 1
14:15       1 1 1 -






1           0 0 0 1

Gruppe 1:
8:12        1 - 0 0
2:6         0 - 1 0
Gruppe 2:
10:14       1 - 1 0
Gruppe 3:
11:15       1 - 1 1

Gruppe 2:
10:11       1 0 1 -
6:7         0 1 1 -
Gruppe 3:
14:15       1 1 1 -


Gruppe 1:
8:10        1 0 - 0
4:6         0 1 - 0
Gruppe 2:
12:!4       1 1 - 0

Gruppe 1:
4:12        - 1 0 0
2:10        - 0 1 0
Gruppe 2:
6:14        - 1 1 0
Gruppe 3:
7:15        - 1 1 1




1           0 0 0 1

Gruppe 1:
8:12        1 - 0 0
2:6         0 - 1 0
Gruppe 2:
10:14       1 - 1 0
Gruppe 3:
11:15       1 - 1 1

8:12:10:14          1 - - 0
2:6:10:14           - - 1 0
10:14:11:15         1 - 1 -

Gruppe 2:
10:11       1 0 1 -
6:7         0 1 1 -
Gruppe 3:
14:15       1 1 1 -

10:11:14:!5         1 - 1 -
6:7:14:15           - 1 1 -


Gruppe 1:
8:10        1 0 - 0
4:6         0 1 - 0
Gruppe 2:
12:!4       1 1 - 0

8:10:12:14          1 - - 0
4:6:12:14           - 1 - 0

Gruppe 1:
4:12        - 1 0 0
2:10        - 0 1 0
Gruppe 2:
6:14        - 1 1 0
Gruppe 3:
7:15        - 1 1 1

4:12:6:14           - 1 - 0
2:10:6:14           - - 1 0
6:14:7:15           - 1 1 -



1                   0 0 0 1
8:12:10:14          1 - - 0
2:6:10:14           - - 1 0
10:14:11:15         1 - 1 -
10:11:14:!5         1 - 1 -
6:7:14:15           - 1 1 -
8:10:12:14          1 - - 0
4:6:12:14           - 1 - 0
4:12:6:14           - 1 - 0
2:10:6:14           - - 1 0
6:14:7:15           - 1 1 -



1                   0 0 0 1
8:12:10:14          1 - - 0
8:10:12:14          1 - - 0
10:14:11:15         1 - 1 -
10:11:14:!5         1 - 1 -
6:7:14:15           - 1 1 -
6:14:7:15           - 1 1 -
4:6:12:14           - 1 - 0
4:12:6:14           - 1 - 0
2:10:6:14           - - 1 0
2:6:10:14           - - 1 0


1                   0 0 0 1
8:12:10:14          1 - - 0
10:14:11:15         1 - 1 -
6:7:14:15           - 1 1 -
4:6:12:14           - 1 - 0
2:10:6:14           - - 1 0


                1   2   4   6   7   8   10  11  12  14  15
1               *
8:12:10:14                          *   *       *   *
10:14:11:15                             *   *       *   *
6:7:14:15                   *   *                   *   *
4:6:12:14              *   *                   *   *
2:10:6:14           *       *           *           *



                1   2   4   6   7   8   10  11  12  14  15
1               *
8:12:10:14                          *   *       *   *               p
10:14:11:15                             *   *       *   *           p
6:7:14:15               *   *                       *   *           p
4:6:12:14               *   *                   *   *               p
2:10:6:14           *       *           *           *               p


1                   0 0 0 1
8:12:10:14          1 - - 0
10:14:11:15         1 - 1 -
6:7:14:15           - 1 1 -
4:6:12:14           - 1 - 0
2:10:6:14           - - 1 0

    y <=    (not x3 and not x2 and not x1 and x0) or
            (x3 and not x0) or
            (x3 and x1) or
            (x2 and x1) or
            (x2 and not x0) or
            (x1 and not x0);

library ieee;
use ieee.std_logic_1164.all;

entity quine20240331 is
port (
    x3, x2, x1, x0: in std_logic;
    y: out std_logic
);
end;

architecture behaviour of quine20240331 is
begin
    y <=    (not x3 and not x2 and not x1 and x0) or
            (x3 and not x0) or
            (x3 and x1) or
            (x2 and x1) or
            (x2 and not x0) or
            (x1 and not x0);
end;

library ieee;
use ieee.std_logic_1164.all;

entity quine20240331testbench is
port (
    y: out std_logic
);
end;

architecture behaviour of quine20240331testbench is
    component quine20240331
    port (
        x3, x2, x1, x0: in std_logic;
        y: out std_logic
    );
    end component;
    signal x3, x2, x1, x0: std_logic;
begin
    q: quine20240331 PORT MAP (x3=>x3, x2=>x2, x1=>x1, x0=>x0, y=>y);

Code: Alles auswählen

library ieee;
use ieee.std_logic_1164.all;

entity quine20240331 is
port (
    x3, x2, x1, x0: in std_logic;
    y: out std_logic
);
end;

architecture behaviour of quine20240331 is
begin
    y <=    (not x3 and not x2 and not x1 and x0) or
            (x3 and not x0) or
            (x3 and x1) or
            (x2 and x1) or
            (x2 and not x0) or
            (x1 and not x0);
end;

library ieee;
use ieee.std_logic_1164.all;

entity quine20240331testbench is
port (
    y: out std_logic
);
end;

architecture behaviour of quine20240331testbench is
    component quine20240331
    port (
        x3, x2, x1, x0: in std_logic;
        y: out std_logic
    );
    end component;
    signal x3, x2, x1, x0: std_logic;
begin
    q: quine20240331 PORT MAP (x3=>x3, x2=>x2, x1=>x1, x0=>x0, y=>y);
    x0 <= '0' after 0 ns, '1' after 10 ns, '0' after 20 ns, '1' after 30 ns, '0' after 40 ns, '1' after 50 ns, '0' after 60 ns, '1' after 70 ns, '0' after 80 ns, '1' after 90 ns, '0' after 100 ns, '1' after 110 ns, '0' after 120 ns, '1' after 130 ns, '0' after 140 ns, '1' after 150 ns;

    x1 <= '0' after 0 ns, '0' after 10 ns, '1' after 20 ns, '1' after 30 ns, '0' after 40 ns, '0' after 50 ns, '1' after 60 ns, '1' after 70 ns, '0' after 80 ns, '0' after 90 ns, '1' after 100 ns, '1' after 110 ns, '0' after 120 ns, '0' after 130 ns, '1' after 140 ns, '1' after 150 ns;

    x2 <= '0' after 0 ns, '0' after 10 ns, '0' after 20 ns, '0' after 30 ns, '1' after 40 ns, '1' after 50 ns, '1' after 60 ns, '1' after 70 ns, '0' after 80 ns, '0' after 90 ns, '0' after 100 ns, '0' after 110 ns, '1' after 120 ns, '1' after 130 ns, '1' after 140 ns, '1' after 150 ns;

    x3 <= '0' after 0 ns, '0' after 10 ns, '0' after 20 ns, '0' after 30 ns, '0' after 40 ns, '0' after 50 ns, '0' after 60 ns, '0' after 70 ns, '1' after 80 ns, '1' after 90 ns, '1' after 100 ns, '1' after 110 ns, '1' after 120 ns, '1' after 130 ns, '1' after 140 ns, '1' after 150 ns;
end;
Bild


Bild

Code: Alles auswählen

Zustand,Eingabe,Ausgabe,Folgezustand
1,0,1,4
1,1,0,1
2,0,1,3
2,1,1,4
3,0,1,1
3,1,1,2
4,0,0,2
4,1,0,3
https://www.ituenix.de/nextcloud/data/d ... 240331.pdf

https://www.ituenix.de/nextcloud/data/d ... 240331.csv

https://www.ituenix.de/nextcloud/data/d ... 240331.tex

Code: Alles auswählen

Zustand,Eingabe,Ausgabe,Folgezustand
1,0,1,4
1,1,0,1
2,0,1,3
2,1,1,4
3,0,1,1
3,1,1,2
4,0,0,2
4,1,0,3

z1 := z1 and x or z3 and not x
z2 := z3 and x or z4 and not x
z3 := z2 and not x or z4 and x
z4 := z1 and not x or z2 and x
y := (z1 and not x or z2 or z3)
Bild

Bild

https://www.ituenix.de/nextcloud/data/d ... 240331.tex

https://www.ituenix.de/nextcloud/data/d ... 240331.pdf


Bild

Bild

Bild

Bild

Bild

Bild

Bild

Bild

Bild

Antworten