forked from zwickethomas/Photonics-Helfer
		
	add sub-prog
This commit is contained in:
		
							parent
							
								
									cc2cf4aed6
								
							
						
					
					
						commit
						8373a04747
					
				
							
								
								
									
										2
									
								
								makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								makefile
									
									
									
									
									
								
							@ -27,7 +27,7 @@ o_FILES := $(addprefix obj/,$(notdir $(c_FILES:.c=.o)))
 | 
			
		||||
#link all .o files
 | 
			
		||||
$(TARGET): $(o_FILES)
 | 
			
		||||
	@echo [CC] link: $<
 | 
			
		||||
	@$(CC) $(LDFLAGS) -o $@ $^
 | 
			
		||||
	@$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
 | 
			
		||||
 | 
			
		||||
#compile all .c Files 
 | 
			
		||||
obj/%.o: src/%.c
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										413
									
								
								src/Fehlenden_Elektronik.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										413
									
								
								src/Fehlenden_Elektronik.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,413 @@
 | 
			
		||||
/* Elektronikhelper
 | 
			
		||||
Dieses Programm ist eine Unterstzützung in der Elektronik.
 | 
			
		||||
Es berechnet leichte rechnungsschritte.
 | 
			
		||||
Autor: Elena und Philip MR1 Semester
 | 
			
		||||
Firma: FHGR
 | 
			
		||||
Version 1.0
 | 
			
		||||
Datum 14.12.2024
 | 
			
		||||
Aenderungen:
 | 
			
		||||
V 1.0 14.12.2024 Erste Version
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
// Bibliothek
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <math.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
// Hilfsfunktionen
 | 
			
		||||
#define PI 3.141592653589793
 | 
			
		||||
#define BOLTZMANN 1.380649e-23
 | 
			
		||||
#define ELEMENTARLADUNG 1.602176634e-19
 | 
			
		||||
 | 
			
		||||
// Funktionen für Widerstandsberechnungen
 | 
			
		||||
void widerstand_berechnen() {
 | 
			
		||||
    double spannung, strom, widerstand;
 | 
			
		||||
    int auswahl;
 | 
			
		||||
    printf("\nWiderstandsberechnung (Ohmsches Gesetz):\n");
 | 
			
		||||
    printf("1. Widerstand berechnen\n");
 | 
			
		||||
    printf("2. Spannung berechnen\n");
 | 
			
		||||
    printf("3. Strom berechnen\n");
 | 
			
		||||
    printf("Wählen Sie eine Option: ");
 | 
			
		||||
    scanf("%d", &auswahl);
 | 
			
		||||
 | 
			
		||||
    switch (auswahl) {
 | 
			
		||||
        case 1:
 | 
			
		||||
            printf("Spannung (in Volt): ");
 | 
			
		||||
            scanf("%lf", &spannung);
 | 
			
		||||
            printf("Strom (in Ampere): ");
 | 
			
		||||
            scanf("%lf", &strom);
 | 
			
		||||
 | 
			
		||||
            if (strom != 0) {
 | 
			
		||||
                widerstand = spannung / strom;
 | 
			
		||||
                printf("Der Widerstand beträgt %.2f Ohm.\n", widerstand);
 | 
			
		||||
            } else {
 | 
			
		||||
                printf("Der Strom darf nicht null sein.\n");
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case 2:
 | 
			
		||||
            printf("Widerstand (in Ohm): ");
 | 
			
		||||
            scanf("%lf", &widerstand);
 | 
			
		||||
            printf("Strom (in Ampere): ");
 | 
			
		||||
            scanf("%lf", &strom);
 | 
			
		||||
 | 
			
		||||
            if (widerstand > 0) {
 | 
			
		||||
                spannung = widerstand * strom;
 | 
			
		||||
                printf("Die Spannung beträgt %.2f Volt.\n", spannung);
 | 
			
		||||
            } else {
 | 
			
		||||
                printf("Der Widerstand muss größer als null sein.\n");
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case 3:
 | 
			
		||||
            printf("Spannung (in Volt): ");
 | 
			
		||||
            scanf("%lf", &spannung);
 | 
			
		||||
            printf("Widerstand (in Ohm): ");
 | 
			
		||||
            scanf("%lf", &widerstand);
 | 
			
		||||
 | 
			
		||||
            if (widerstand > 0) {
 | 
			
		||||
                strom = spannung / widerstand;
 | 
			
		||||
                printf("Der Strom beträgt %.2f Ampere.\n", strom);
 | 
			
		||||
            } else {
 | 
			
		||||
                printf("Der Widerstand muss größer als null sein.\n");
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        default:
 | 
			
		||||
            printf("Ungültige Auswahl.\n");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void parallelschaltung_berechnen() {
 | 
			
		||||
    int anzahl;
 | 
			
		||||
    double widerstand, gesamtwiderstand = 0;
 | 
			
		||||
    printf("\nParallelschaltung von Widerständen:\n");
 | 
			
		||||
    printf("Anzahl der Widerstände: ");
 | 
			
		||||
    scanf("%d", &anzahl);
 | 
			
		||||
 | 
			
		||||
    for (int i = 0; i < anzahl; i++) {
 | 
			
		||||
        printf("Widerstand %d (in Ohm): ", i + 1);
 | 
			
		||||
        scanf("%lf", &widerstand);
 | 
			
		||||
        if (widerstand > 0) {
 | 
			
		||||
            gesamtwiderstand += 1 / widerstand;
 | 
			
		||||
        } else {
 | 
			
		||||
            printf("Ein Widerstand muss größer als null sein.\n");
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (gesamtwiderstand > 0) {
 | 
			
		||||
        gesamtwiderstand = 1 / gesamtwiderstand;
 | 
			
		||||
        printf("Der Gesamtwiderstand der Parallelschaltung beträgt %.2f Ohm.\n", gesamtwiderstand);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void reihenschaltung_berechnen() {
 | 
			
		||||
    int anzahl;
 | 
			
		||||
    double widerstand, gesamtwiderstand = 0;
 | 
			
		||||
    printf("\nReihenschaltung von Widerständen:\n");
 | 
			
		||||
    printf("Anzahl der Widerstände: ");
 | 
			
		||||
    scanf("%d", &anzahl);
 | 
			
		||||
 | 
			
		||||
    for (int i = 0; i < anzahl; i++) {
 | 
			
		||||
        printf("Widerstand %d (in Ohm): ", i + 1);
 | 
			
		||||
        scanf("%lf", &widerstand);
 | 
			
		||||
        if (widerstand > 0) {
 | 
			
		||||
            gesamtwiderstand += widerstand;
 | 
			
		||||
        } else {
 | 
			
		||||
            printf("Ein Widerstand muss größer als null sein.\n");
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    printf("Der Gesamtwiderstand der Reihenschaltung beträgt %.2f Ohm.\n", gesamtwiderstand);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void komplexe_schaltung_berechnen() {
 | 
			
		||||
    int anzahlReihen, anzahlParallel;
 | 
			
		||||
    double reihenWiderstand = 0, parallelWiderstand = 0, gesamtwiderstand = 0;
 | 
			
		||||
 | 
			
		||||
    printf("\nBerechnung komplexer Netzwerke:\n");
 | 
			
		||||
 | 
			
		||||
    // Reihenschaltung
 | 
			
		||||
    printf("Anzahl der Widerstände in der Reihenschaltung: ");
 | 
			
		||||
    scanf("%d", &anzahlReihen);
 | 
			
		||||
    for (int i = 0; i < anzahlReihen; i++) {
 | 
			
		||||
        double widerstand;
 | 
			
		||||
        printf("Widerstand %d (in Ohm): ", i + 1);
 | 
			
		||||
        scanf("%lf", &widerstand);
 | 
			
		||||
        if (widerstand > 0) {
 | 
			
		||||
            reihenWiderstand += widerstand;
 | 
			
		||||
        } else {
 | 
			
		||||
            printf("Ein Widerstand muss größer als null sein.\n");
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Parallelschaltung
 | 
			
		||||
    printf("Anzahl der Widerstände in der Parallelschaltung: ");
 | 
			
		||||
    scanf("%d", &anzahlParallel);
 | 
			
		||||
    for (int i = 0; i < anzahlParallel; i++) {
 | 
			
		||||
        double widerstand;
 | 
			
		||||
        printf("Widerstand %d (in Ohm): ", i + 1);
 | 
			
		||||
        scanf("%lf", &widerstand);
 | 
			
		||||
        if (widerstand > 0) {
 | 
			
		||||
            parallelWiderstand += 1 / widerstand;
 | 
			
		||||
        } else {
 | 
			
		||||
            printf("Ein Widerstand muss größer als null sein.\n");
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (parallelWiderstand > 0) {
 | 
			
		||||
        parallelWiderstand = 1 / parallelWiderstand;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Gesamtwiderstand
 | 
			
		||||
    gesamtwiderstand = reihenWiderstand + parallelWiderstand;
 | 
			
		||||
    printf("Der Gesamtwiderstand des Netzwerks beträgt %.2f Ohm.\n", gesamtwiderstand);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Spannungsteiler-Funktion
 | 
			
		||||
void spannungsteiler_berechnen() {
 | 
			
		||||
    int anzahl;
 | 
			
		||||
    double vin, vout, gesamtwiderstand = 0;
 | 
			
		||||
    printf("\nSpannungsteiler-Berechnung:\n");
 | 
			
		||||
    printf("Anzahl der Widerstände im Spannungsteiler: ");
 | 
			
		||||
    scanf("%d", &anzahl);
 | 
			
		||||
 | 
			
		||||
    double widerstaende[anzahl];
 | 
			
		||||
    for (int i = 0; i < anzahl; i++) {
 | 
			
		||||
        printf("Widerstand R%d (in Ohm): ", i + 1);
 | 
			
		||||
        scanf("%lf", &widerstaende[i]);
 | 
			
		||||
        gesamtwiderstand += widerstaende[i];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    printf("Eingangsspannung Vin (in Volt): ");
 | 
			
		||||
    scanf("%lf", &vin);
 | 
			
		||||
 | 
			
		||||
    for (int i = 0; i < anzahl; i++) {
 | 
			
		||||
        vout = vin * (widerstaende[i] / gesamtwiderstand);
 | 
			
		||||
        printf("Spannung über R%d beträgt %.2f Volt.\n", i + 1, vout);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Leistungsberechnung
 | 
			
		||||
void leistung_berechnen() {
 | 
			
		||||
    double spannung, strom, leistung;
 | 
			
		||||
    int auswahl;
 | 
			
		||||
    printf("\nLeistungsberechnung:\n");
 | 
			
		||||
    printf("1. Leistung berechnen (benötigt Spannung und Strom)\n");
 | 
			
		||||
    printf("2. Spannung berechnen (benötigt Leistung und Strom)\n");
 | 
			
		||||
    printf("3. Strom berechnen (benötigt Leistung und Spannung)\n");
 | 
			
		||||
    printf("Wählen Sie eine Option: ");
 | 
			
		||||
    scanf("%d", &auswahl);
 | 
			
		||||
 | 
			
		||||
    switch (auswahl) {
 | 
			
		||||
        case 1:
 | 
			
		||||
            printf("Spannung (in Volt): ");
 | 
			
		||||
            scanf("%lf", &spannung);
 | 
			
		||||
            printf("Strom (in Ampere): ");
 | 
			
		||||
            scanf("%lf", &strom);
 | 
			
		||||
 | 
			
		||||
            leistung = spannung * strom;
 | 
			
		||||
            printf("Die Leistung beträgt %.2f Watt.\n", leistung);
 | 
			
		||||
            break;
 | 
			
		||||
        case 2:
 | 
			
		||||
            printf("Leistung (in Watt): ");
 | 
			
		||||
            scanf("%lf", &leistung);
 | 
			
		||||
            printf("Strom (in Ampere): ");
 | 
			
		||||
            scanf("%lf", &strom);
 | 
			
		||||
 | 
			
		||||
            if (strom > 0) {
 | 
			
		||||
                spannung = leistung / strom;
 | 
			
		||||
                printf("Die Spannung beträgt %.2f Volt.\n", spannung);
 | 
			
		||||
            } else {
 | 
			
		||||
                printf("Der Strom muss größer als null sein.\n");
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case 3:
 | 
			
		||||
            printf("Leistung (in Watt): ");
 | 
			
		||||
            scanf("%lf", &leistung);
 | 
			
		||||
            printf("Spannung (in Volt): ");
 | 
			
		||||
            scanf("%lf", &spannung);
 | 
			
		||||
 | 
			
		||||
            if (spannung > 0) {
 | 
			
		||||
                strom = leistung / spannung;
 | 
			
		||||
                printf("Der Strom beträgt %.2f Ampere.\n", strom);
 | 
			
		||||
            } else {
 | 
			
		||||
                printf("Die Spannung muss größer als null sein.\n");
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        default:
 | 
			
		||||
            printf("Ungültige Auswahl.\n");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Weitere Funktionen (Dioden, Transistoren, Kondensatoren, LEDs, Knoten-/Maschenregel)
 | 
			
		||||
void dioden_berechnen() {
 | 
			
		||||
    double temperatur, schwellenspannung, is, strom;
 | 
			
		||||
    printf("\nDioden-Berechnung:\n");
 | 
			
		||||
    printf("Geben Sie die Temperatur (in Kelvin) ein: ");
 | 
			
		||||
    scanf("%lf", &temperatur);
 | 
			
		||||
    printf("Geben Sie den Sättigungsstrom Is (in Ampere) ein: ");
 | 
			
		||||
    scanf("%lf", &is);
 | 
			
		||||
    printf("Geben Sie die Schwellenspannung der Diode (in Volt) ein: ");
 | 
			
		||||
    scanf("%lf", &schwellenspannung);
 | 
			
		||||
 | 
			
		||||
    double vt = (BOLTZMANN * temperatur) / ELEMENTARLADUNG;
 | 
			
		||||
    strom = is * (exp(schwellenspannung / vt) - 1);
 | 
			
		||||
    printf("Der Strom durch die Diode beträgt %.6f Ampere.\n", strom);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void transistor_berechnen() {
 | 
			
		||||
    double verstärkung, basisstrom, kollektorstrom, sättigungsspannung;
 | 
			
		||||
    printf("\nTransistor-Berechnung:\n");
 | 
			
		||||
    printf("Verstärkungsfaktor (hFE): ");
 | 
			
		||||
    scanf("%lf", &verstärkung);
 | 
			
		||||
    printf("Basisstrom (in Ampere): ");
 | 
			
		||||
    scanf("%lf", &basisstrom);
 | 
			
		||||
 | 
			
		||||
    kollektorstrom = verstärkung * basisstrom;
 | 
			
		||||
    printf("Der Kollektorstrom beträgt %.6f Ampere.\n", kollektorstrom);
 | 
			
		||||
 | 
			
		||||
    printf("Sättigungsspannung (in Volt): ");
 | 
			
		||||
    scanf("%lf", &sättigungsspannung);
 | 
			
		||||
    printf("Die Sättigungsspannung beträgt %.2f Volt.\n", sättigungsspannung);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kondensator_berechnen() {
 | 
			
		||||
    double kapazität, spannung, energie, zeit, widerstand;
 | 
			
		||||
    printf("\nKondensator-Berechnung:\n");
 | 
			
		||||
    printf("Kapazität (in Farad): ");
 | 
			
		||||
    scanf("%lf", &kapazität);
 | 
			
		||||
    printf("Spannung (in Volt): ");
 | 
			
		||||
    scanf("%lf", &spannung);
 | 
			
		||||
 | 
			
		||||
    energie = 0.5 * kapazität * pow(spannung, 2);
 | 
			
		||||
    printf("Die Energie im Kondensator beträgt %.6f Joule.\n", energie);
 | 
			
		||||
 | 
			
		||||
    printf("Entladezeit berechnen? (1 für Ja, 0 für Nein): ");
 | 
			
		||||
    int wahl;
 | 
			
		||||
    scanf("%d", &wahl);
 | 
			
		||||
 | 
			
		||||
    if (wahl == 1) {
 | 
			
		||||
        printf("Widerstand (in Ohm): ");
 | 
			
		||||
        scanf("%lf", &widerstand);
 | 
			
		||||
        zeit = kapazität * widerstand;
 | 
			
		||||
        printf("Die Zeitkonstante beträgt %.2f Sekunden.\n", zeit);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void led_vorwiderstand_berechnen() {
 | 
			
		||||
    double betriebsspannung, durchlassspannung, strom, vorwiderstand, verlustleistung;
 | 
			
		||||
    printf("\nLED-Vorwiderstandsberechnung:\n");
 | 
			
		||||
    printf("Betriebsspannung (in Volt): ");
 | 
			
		||||
    scanf("%lf", &betriebsspannung);
 | 
			
		||||
    printf("Durchlassspannung der LED (in Volt): ");
 | 
			
		||||
    scanf("%lf", &durchlassspannung);
 | 
			
		||||
    printf("Strom durch die LED (in Ampere): ");
 | 
			
		||||
    scanf("%lf", &strom);
 | 
			
		||||
 | 
			
		||||
    vorwiderstand = (betriebsspannung - durchlassspannung) / strom;
 | 
			
		||||
    verlustleistung = pow((betriebsspannung - durchlassspannung), 2) / vorwiderstand;
 | 
			
		||||
 | 
			
		||||
    printf("Der Vorwiderstand beträgt %.2f Ohm.\n", vorwiderstand);
 | 
			
		||||
    printf("Die maximale Verlustleistung des Widerstands beträgt %.2f Watt.\n", verlustleistung);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void knotenregel_berechnen() {
 | 
			
		||||
    int n;  // Anzahl der Ströme und Spannungen
 | 
			
		||||
    float sum_current = 0.0, current;
 | 
			
		||||
 | 
			
		||||
    // Knotenregel: Ströme berechnen
 | 
			
		||||
    printf("Geben Sie die Anzahl der Stroeme ein im Knoten: ");
 | 
			
		||||
    scanf("%d", &n);
 | 
			
		||||
 | 
			
		||||
    printf("Geben Sie die Stroeme ein (in Ampere):\n");
 | 
			
		||||
    for (int i = 1; i <= n; i++) {
 | 
			
		||||
        printf("Strom %d: ", i);
 | 
			
		||||
        scanf("%f", ¤t);
 | 
			
		||||
        sum_current += current;  // Ströme addieren
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    printf("\nSumme der Ströme: %.2f A\n", sum_current);
 | 
			
		||||
    if (sum_current == 0) {
 | 
			
		||||
        printf("Der Knoten erfüllt die Knotenregel (Summe der Ströme ist null).\n");
 | 
			
		||||
    } else {
 | 
			
		||||
        printf("Der Knoten erfüllt die Knotenregel nicht (Summe der Ströme ist %.2f).\n", sum_current);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void maschenregel_berechnen() {
 | 
			
		||||
    int n;  // Anzahl der Ströme und Spannungen
 | 
			
		||||
    float sum_voltage = 0.0, voltage;
 | 
			
		||||
    // Maschenregel: Spannungen berechnen
 | 
			
		||||
    printf("\nGeben Sie die Anzahl der Spannungen in einer Masche ein: ");
 | 
			
		||||
    scanf("%d", &n);
 | 
			
		||||
 | 
			
		||||
    printf("Geben Sie die Spannungen ein (in Volt):\n");
 | 
			
		||||
    for (int i = 1; i <= n; i++) {
 | 
			
		||||
        printf("Spannung %d: ", i);
 | 
			
		||||
        scanf("%f", &voltage);
 | 
			
		||||
        sum_voltage += voltage;  // Spannungen addieren
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Überprüfung der Maschenregel
 | 
			
		||||
    printf("\nSumme der Spannungen: %.2f V\n", sum_voltage);
 | 
			
		||||
    if (sum_voltage == 0) {
 | 
			
		||||
        printf("Die Masche erfüllt die Maschenregel (Summe der Spannungen ist null).\n");
 | 
			
		||||
    } else {
 | 
			
		||||
        printf("Die Masche erfüllt die Maschenregel nicht (Summe der Spannungen ist %.2f).\n", sum_voltage);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int Fehlenden_Elektronik_main() {
 | 
			
		||||
    char auswahl[21] = {0};
 | 
			
		||||
    long auswahl_int = 0;
 | 
			
		||||
    char *endptr;
 | 
			
		||||
 | 
			
		||||
    do {
 | 
			
		||||
        printf("\nElektronik-Berechnungstool:\n");
 | 
			
		||||
        printf("1. Widerstandsberechnung (Ohmsches Gesetz)\n");
 | 
			
		||||
        printf("2. Parallelschaltung von Widerständen\n");
 | 
			
		||||
        printf("3. Reihenschaltung von Widerständen\n");
 | 
			
		||||
        printf("4. Komplexe Netzwerke\n");
 | 
			
		||||
        printf("5. Spannungsteiler\n");
 | 
			
		||||
        printf("6. Leistungsberechnung\n");
 | 
			
		||||
        printf("7. Dioden-Berechnung\n");
 | 
			
		||||
        printf("8. Transistor-Berechnung\n");
 | 
			
		||||
        printf("9. Kondensator-Berechnung\n");
 | 
			
		||||
        printf("10. LED-Vorwiderstandsberechnung\n");
 | 
			
		||||
        printf("11. Knotenregel-Berechnung\n");
 | 
			
		||||
        printf("12. Maschenregel-Berechnung\n");
 | 
			
		||||
        printf("0. Beenden\n");
 | 
			
		||||
        printf("Wählen Sie eine Option: ");
 | 
			
		||||
        scanf("%20s", auswahl);
 | 
			
		||||
        auswahl_int = strtol((const char*)auswahl, &endptr, 10);
 | 
			
		||||
 | 
			
		||||
        if (*endptr != 0){
 | 
			
		||||
            auswahl_int = -1;
 | 
			
		||||
        }
 | 
			
		||||
        if (*endptr == 'q'){
 | 
			
		||||
        return 10;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        switch (auswahl_int) {
 | 
			
		||||
            case 1: widerstand_berechnen(); break;
 | 
			
		||||
            case 2: parallelschaltung_berechnen(); break;
 | 
			
		||||
            case 3: reihenschaltung_berechnen(); break;
 | 
			
		||||
            case 4: komplexe_schaltung_berechnen(); break;
 | 
			
		||||
            case 5: spannungsteiler_berechnen(); break;
 | 
			
		||||
            case 6: leistung_berechnen(); break;
 | 
			
		||||
            case 7: dioden_berechnen(); break;
 | 
			
		||||
            case 8: transistor_berechnen(); break;
 | 
			
		||||
            case 9: kondensator_berechnen(); break;
 | 
			
		||||
            case 10: led_vorwiderstand_berechnen(); break;
 | 
			
		||||
            case 11: knotenregel_berechnen(); break;
 | 
			
		||||
            case 12: maschenregel_berechnen(); break;
 | 
			
		||||
            case 0: printf("Programm beendet.\n"); break;
 | 
			
		||||
            default: printf("Ungültige Auswahl.\n");
 | 
			
		||||
        }
 | 
			
		||||
    } while (auswahl_int != 0);
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										10
									
								
								src/Fehlenden_Elektronik.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/Fehlenden_Elektronik.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
			
		||||
#ifndef Fehlenden_Elektronik_H_ 
 | 
			
		||||
#define Fehlenden_Elektronik_H_ 
 | 
			
		||||
 | 
			
		||||
// #ifndef _FILE_NAME_H_ 
 | 
			
		||||
// #define _FILE_NAME_H_ 
 | 
			
		||||
 | 
			
		||||
   // extern int kbhit();
 | 
			
		||||
   int Fehlenden_Elektronik_main();
 | 
			
		||||
   
 | 
			
		||||
#endif
 | 
			
		||||
@ -1,10 +1,6 @@
 | 
			
		||||
#ifndef kbhit_linux_H_ 
 | 
			
		||||
#define kbhit_linux_H_ 
 | 
			
		||||
#ifndef KBHIT_LINUX_H_ 
 | 
			
		||||
#define KBHIT_LINUX_H_ 
 | 
			
		||||
 | 
			
		||||
// #ifndef _FILE_NAME_H_ 
 | 
			
		||||
// #define _FILE_NAME_H_ 
 | 
			
		||||
 | 
			
		||||
   // extern int kbhit();
 | 
			
		||||
int kbhit();
 | 
			
		||||
   
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -32,6 +32,7 @@ Datum: 04.12.2024
 | 
			
		||||
 | 
			
		||||
// import sub programme
 | 
			
		||||
#include "Ramen_Physik.h"
 | 
			
		||||
#include "Fehlenden_Elektronik.h"
 | 
			
		||||
#include "test_prog.h"
 | 
			
		||||
 | 
			
		||||
#include "pipes_test.h"
 | 
			
		||||
@ -179,7 +180,7 @@ void print_menu(int terminal_width, int terminal_height, int line){
 | 
			
		||||
        print_line("┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓", spaces, (0 <= line && line < 1) ? ";31": ";37");
 | 
			
		||||
        print_line("┃  1 Ramen Physik                       ┃", spaces, (0 <= line && line < 1) ? ";31": ";37");
 | 
			
		||||
        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (0 <= line && line < 2) ? ";31": ";37");
 | 
			
		||||
        print_line("┃  2 Programm                           ┃", spaces, (1 <= line && line < 2) ? ";31": ";37");
 | 
			
		||||
        print_line("┃  2 Fehlenden Elektronik               ┃", spaces, (1 <= line && line < 2) ? ";31": ";37");
 | 
			
		||||
        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (1 <= line && line < 3) ? ";31": ";37");
 | 
			
		||||
        print_line("┃  3 Programm                           ┃", spaces, (2 <= line && line < 3) ? ";31": ";37");
 | 
			
		||||
        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (2 <= line && line < 4) ? ";31": ";37");
 | 
			
		||||
@ -239,7 +240,7 @@ void run_programm(int programm, int width, int height, bool *used){
 | 
			
		||||
    int return_code = 0;
 | 
			
		||||
    switch (programm) {
 | 
			
		||||
        case 0: return_code = Ramen_Physik(); break;
 | 
			
		||||
        case 1: return_code = test_gruppe_programmname(); break;
 | 
			
		||||
        case 1: return_code = Fehlenden_Elektronik_main(); break;
 | 
			
		||||
        case 2: return_code = test_gruppe_programmname(); break;
 | 
			
		||||
        case 3: return_code = test_gruppe_programmname(); break;
 | 
			
		||||
        case 4: return_code = test_gruppe_programmname(); break;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										28
									
								
								src/pipes2.c
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								src/pipes2.c
									
									
									
									
									
								
							@ -18,34 +18,6 @@
 | 
			
		||||
#define GRID_GROESSE_Y 60
 | 
			
		||||
#define SLEEP_TIME 10000
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
int kbhit(void)
 | 
			
		||||
{
 | 
			
		||||
  struct termios oldt, newt;
 | 
			
		||||
  int ch;
 | 
			
		||||
  int oldf;
 | 
			
		||||
 
 | 
			
		||||
  tcgetattr(STDIN_FILENO, &oldt);
 | 
			
		||||
  newt = oldt;
 | 
			
		||||
  newt.c_lflag &= ~(ICANON | ECHO);
 | 
			
		||||
  tcsetattr(STDIN_FILENO, TCSANOW, &newt);
 | 
			
		||||
  oldf = fcntl(STDIN_FILENO, F_GETFL, 0);
 | 
			
		||||
  fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK);
 | 
			
		||||
 
 | 
			
		||||
  ch = getchar();
 | 
			
		||||
 
 | 
			
		||||
  tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
 | 
			
		||||
  fcntl(STDIN_FILENO, F_SETFL, oldf);
 | 
			
		||||
 
 | 
			
		||||
  if(ch != EOF)
 | 
			
		||||
  {
 | 
			
		||||
    ungetc(ch, stdin);
 | 
			
		||||
    return 1;
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
void print_at(int x, int y, char c[4])
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user