#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #define ERR_FILE_WRON_FORMAT 3 #define ERR_FILE_WRON_FORMAT_MSG "IO-Error: File Wrong Format" #define MAX_STR_INPUT_LEN 128 #define MAX_SPECIAL_STATES 3 #define MAX_STATES 6 #define MIN_STATE 1 #define SPECIAL_STATE_1 1 #define SPECIAL_STATE_2 2 #define SPECIAL_STATE_3 3 #define MAX_INPUTS 2 #define MAX_OUTPUTS 2 #define TRUE 1 #define FALSE 0 #define Z_A 0 #define Z_B 1 void readcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) { int i; int j; int i1, i2; int x1, x2; char s [MAX_STR_INPUT_LEN]; //scanf ("Zustand,Eingabe,Ausgabe,Folgezustandn"); scanf ("%sn", s); if (strcmp (s, "Zustand,Eingabe,Ausgabe,Folgezustand") != 0) { printf ("%sn", ERR_FILE_WRON_FORMAT_MSG); exit (ERR_FILE_WRON_FORMAT); } for (i = 0; i < MAX_STATES ; i++) { scanf ("%i,%i,%i,%in", \&i1, \&x1, \&y [Z_A][i], \&a [i]); scanf ("%i,%i,%i,%in", \&i2, \&x2, \&y [Z_B][i], \&b [i]); if (x1 != Z_A) { printf ("%sn", ERR_FILE_WRON_FORMAT_MSG); exit (ERR_FILE_WRON_FORMAT); } if (x2 != Z_B) { printf ("%sn", ERR_FILE_WRON_FORMAT_MSG); exit (ERR_FILE_WRON_FORMAT); } if (i1 != (i+1)) { printf ("%sn", ERR_FILE_WRON_FORMAT_MSG); exit (ERR_FILE_WRON_FORMAT); } if (i2 != (i+1)) { printf ("%sn", ERR_FILE_WRON_FORMAT_MSG); exit (ERR_FILE_WRON_FORMAT); } } return; } void printcsv (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) { int i; printf ("Zustand,Eingabe,Ausgabe,Folgezustandn"); for (i = 0; i < (MAX_STATES); i++) { printf ("%i,%i,%i,%in", i+MIN_STATE, Z_A, y [Z_A][i], a [i]); printf ("%i,%i,%i,%in", i+MIN_STATE, Z_B, y [Z_B][i], b [i]); } return; } void createnew (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) { #define RAND_1 32 #define RAND_2 16 #define RAND_3 16 #define RAND_4 8 #define N_SORTS 8 time_t t; int i, j; int flag; int s; srand ((unsigned)time (\&t)); for (i = 0; i < MAX_STATES; i++) { a [i] = i + MIN_STATE; b [i] = i + MIN_STATE; } flag = 0; for (s = 0; s < N_SORTS; s++) while (!flag) { for (i = 0; i < MAX_STATES; i++) { for (j = i + 1; j < MAX_STATES; j++) { if ((rand () % RAND_1) > RAND_2) { t = a [j]; a [j] = a [i]; a [i] = t; } } } for (i = 0; i < MAX_STATES; i++) { for (j = i + 1; j < MAX_STATES; j++) { if ((rand () % RAND_3) < RAND_4) { t = b [j]; b [j] = b [i]; b [i] = t; } } } flag = TRUE; for (i = 0; i < MAX_STATES; i++) if ((a [i] == b [i]) \&\& (b [i] == (i+MIN_STATE))) { flag = FALSE; } } for (i = 0; i < MAX_STATES; i++) { y [Z_A][i] = rand () % MAX_OUTPUTS; y [Z_B][i] = rand () % MAX_OUTPUTS; } return; } void printtex (int a [], int b [], int y [MAX_OUTPUTS][MAX_STATES]) { int i, j; int codez = 8; printf("\documentclass{article}n"); printf("\usepackage[utf8]{inputenc}n"); printf("\usepackage{pgf, tikz}n"); printf("\usetikzlibrary{arrows , automata , positioning}n"); printf("\begin{document}nn"); printf("\begin{center}n"); printf("\begin{tikzpicture}[>=stealth',shorten >=1pt,auto,node distance=2.5cm]n"); printf("%Knotenn"); printf("\node (1) [state, thick] {1};n"); printf("\node (2) [state, thick, right of= 1] {2};n"); printf("\node (3) [state, thick, right of= 2] {3};n"); printf("\node (4) [state, thick, right of= 3] {4};nn"); printf("\node (5) [state, thick, right of= 4] {5};nn"); printf("\node (6) [state, thick, right of= 5] {6};nn"); printf("%Verbindungenn"); printf("\path[thick,->]n"); char *leftright [] = {"left", "right"}; char *abovebelow [] = {"above", "below"}; char rorl[2] = {'R', 'L'}; for (i = 0; i < MAX_STATES; i++) { if ((a [i] - MIN_STATE) == i) printf ("(%i) edge [loop] node {%i/%i,%c} (%i)n", i + MIN_STATE, Z_A, y [Z_A][i], rorl [rand () % 2], a [i]); else printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i,%c} (%i)n", i + MIN_STATE, (i+1)*10+(a[i]-MIN_STATE)*5, leftright [(i>(a [i]-MIN_STATE))\&\&((a [i]-MIN_STATE) != 3)], abovebelow [((i+1)<=a[i])\&\&(a[i] != 4)], Z_A, y [Z_A][i], rorl [rand () % 2], a [i]); if ((b [i] - MIN_STATE) == i) printf ("(%i) edge [loop] node {%i/%i,%c} (%i)n", i + MIN_STATE, Z_B, y [Z_B][i], rorl [rand () % 2], b [i]); else printf ("(%i) edge [bend angle=%i, bend %s,%s] node {%i/%i,%c} (%i)n", i + MIN_STATE, (i+1)*25+(b[i]-MIN_STATE)*8, leftright [(i<=(b [i]-MIN_STATE)) \&\&((b [i]-MIN_STATE) != 3)], abovebelow [((i+MIN_STATE)>b [i])\&\&(b [i] != 4)], Z_B, y [Z_B][i], rorl [rand () % 2], b [i]); } printf(";n"); printf("\end{tikzpicture}n"); printf("\end{center}n"); printf ("\begin{center}n"); printf ("\begin{verbatim}n"); for (i = 0; i < 32; i++) { printf ("%i ", rand () % 2); } printf("end{verbatim}n"); printf("\end{center}n"); /*printf ("\begin{center}n"); printf ("\begin{tabular}{|l|l|l|l||l|l|l|l|}n"); n"); printf ("Zustand \& Eingabe \& Ausgabe \& Folgezustand \& \multicolumn{4}{|l|}{Codefolgezustand}n"); n"); printf BITTE IM PDF NACHGUCKEN n"); for (i = 0; i < MAX_STATES; i++) { printf BITTE IM PDF NACHGUCKEN printf BITTE IM PDF NACHGUCKEN } n"); printf ("\end{tabular}n"); printf ("\end{center}n"); printf ("\begin{center}n"); printf ("\begin{verbatim}n"); for (i = MIN_STATE; i < (MAX_STATES + MIN_STATE); i++) { printf ("z%i+ := ", i); for (j = 0; j < MAX_STATES; j++) { if ( a [j] == i ) printf ("z%i and x or ", j+MIN_STATE, y [j]); if ( b [j] == i ) printf ("z%i and not x or ", j+MIN_STATE, y [j]); } printf (" true;n"); } printf ("end{verbatim}n"); printf ("\end{center}n");*/ printf("\end{document}n"); } int main (int argc, char *argv []) { #define CREATE_NEW 0 #define READ_CSV 1 #define PRINT_TEX 0 #define PRINT_CSV 1 #define PRINT_NO_HELP 0 #define PRINT_HELP 1 int b [MAX_STATES]; int a [MAX_STATES]; int y [MAX_OUTPUTS][MAX_STATES]; int argi; int createnew_readcsv = CREATE_NEW; int printraw_printtex_print_csv = PRINT_CSV; int printhelp = PRINT_NO_HELP; for (argi = 1; argi < argc; argi++) { if ((strcmp ("--create-new", argv [argi]) == 0) || (strcmp ("-n", argv [argi]) == 0)) createnew_readcsv = CREATE_NEW; if ((strcmp ("--read-csv", argv [argi]) == 0) || (strcmp ("-s", argv [argi]) == 0)) createnew_readcsv = READ_CSV; if ((strcmp ("--print-csv", argv [argi]) == 0) || (strcmp ("-c", argv [argi]) == 0)) printraw_printtex_print_csv = PRINT_CSV; if ((strcmp ("--print-tex", argv [argi]) == 0) || (strcmp ("-t", argv [argi]) == 0)) printraw_printtex_print_csv = PRINT_TEX; if ((strcmp ("--help", argv [argi]) == 0) || (strcmp ("-h", argv [argi]) == 0)) printhelp = PRINT_HELP; } if (printhelp == PRINT_HELP) { printf ("--create-newn-nnn"); printf ("--read-csvn-rnn"); printf ("--print-csvn-cnn"); printf ("--print-texn-tnn"); printf ("--helpn-hnn"); return 2; } if (createnew_readcsv == CREATE_NEW) createnew (a, b, y); else if (createnew_readcsv == READ_CSV) readcsv (a, b, y); if (printraw_printtex_print_csv == PRINT_TEX) printtex (a, b, y); else if (printraw_printtex_print_csv == PRINT_CSV) printcsv (a, b, y); return 0; }amm wie alles andere drauf wie aber kurz rechnen die ueblichen Rechenaufgaben kommt zu den Standarduebungen einfach immer machen.
1.) Rechne die Zahl in binaer Darstellung in eine Dezimale Darstellung um 1100101001110101b 51829d 2.) Rechne die Zahl in dezimal darstellung in eine Binaerdarstellung um 30698 0111011111101010 3.) Addiere die drei Zahlen schriftlich 5402 + 12366 + 23461 ----------------- 41229 4.) Subtrahiere die letzten drei Zahlen schriftlich von der ersten schriftlich 64244 - 1100 - 377 - 12064 ----------------- 50703 5.) Rechne die Zahl ins zweier komplement um, mit 8 Bit - und subtrahiere diese zahl von der ersten und rechne das Ergebnis nach dezimal -41 -124 = -165 11010111 10000100 = 01011011 6.) Multipliziere die zwei Zahlen schriftlich 31669*38981 = 1234489289 7.) Dividiere die zwei Zahlen schriftlich 16210/61036 = 0 8.) Errechne x Logarithmisch mit dem Taschenrechner 48285\^x = 600927163 9.) Errechne mit dem Abakus 52 + 8 + 45 + 6 + 89 + 20 + 3 + 49 + 80 + 14
11 21 18 18 19 Fall 2 1 2 3 4 5 6 7 8 9 10 1 4 9 16 25 36 49 64 81 100
# 2024-07-20 print (4+5+2) print (7*3) x = 5+13 y = 7+11 z = 2+17 print (x) print (y) print (z) if x < z: if x < y: print ("Fall 1") else: print ("Fall 2") else: print ("Fall 3") i = 0 while i < 10: print (i+1) i = i + 1 a = [1, 4] i = 0 while i < 8: a.append ((i+3)**2) i = i + 1 i = 0 while i < 10: print (a [i]) i = i + 1
#!/bin/bash if [[ "\$1" == "David" \&\& "\$2" == "Vajda " ]] then echo "Das bin ich" elif [[ "\$1" == "David" \&\& -z "\$2" ]] then echo "Das koennte ich sein" else i=0 while [ \$i -lt 10 ] do echo "Hallo zum \$((\$i+1)).1" i=\$((\$i+1)) done a=(a b c d) a+=(e f g h) i=0 while [ \$i -lt 8 ] do echo "\${a[\$i]}" i=\$((\$i+1)) done for s in "\${a[@]}" do echo "\$s" done l=\$(ls *.jpg) for s in \$l do echo "\$s" done fi
Hallo zum 1.1 Hallo zum 2.1 Hallo zum 3.1 Hallo zum 4.1 Hallo zum 5.1 Hallo zum 6.1 Hallo zum 7.1 Hallo zum 8.1 Hallo zum 9.1 Hallo zum 10.1 a b c d e f g h a b c d e f g h Bin20240707v2-1.jpg Bin20240707v3-1.jpg DeutschlandEuler-1.jpg Euler20240711-1.jpg Euler20240711v2-1.jpg Euler20240715-1.jpg Euler20240715v2-1.jpg Euler20240715v3-1.jpg HausNikolaus20240707v2-1.jpg HausNikolaus20240711-1.jpg Klee20240708v1-1.jpg Klee20240708v2-1.jpg Klee20240708v3-1.jpg Klee20240708v4-1.jpg touring20240720-1.jpg touring20240720a-1.jpg touring20240720b-1.jpg touring20240720c-1.jpg touring20240720d-1.jpg touring20240720e-1.jpg
So, ich mache jetzt hier diese touring machine jetzt als beispiel