add Drehmoment
This commit is contained in:
		
							parent
							
								
									11a6427c94
								
							
						
					
					
						commit
						1a4f0576a3
					
				@ -4,7 +4,6 @@
 | 
				
			|||||||
// #ifndef _FILE_NAME_H_ 
 | 
					// #ifndef _FILE_NAME_H_ 
 | 
				
			||||||
// #define _FILE_NAME_H_ 
 | 
					// #define _FILE_NAME_H_ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   // extern int kbhit();
 | 
					 | 
				
			||||||
   int Fehlenden_Elektronik_main();
 | 
					   int Fehlenden_Elektronik_main();
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										153
									
								
								src/Haenchen-vz/Haenchen_Drehmoment.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										153
									
								
								src/Haenchen-vz/Haenchen_Drehmoment.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,153 @@
 | 
				
			|||||||
 | 
					/* Haenchen_Drehmoment.c
 | 
				
			||||||
 | 
					Thema: Programm das einem das Rechnen mit Drehmomenten erleichtert.
 | 
				
			||||||
 | 
					Autoren: Glenn Robin Rahts & Jonas Michael Aufschläger
 | 
				
			||||||
 | 
					Firma: FHGR
 | 
				
			||||||
 | 
					Version: 0.1
 | 
				
			||||||
 | 
					Datum: 13.12.2024
 | 
				
			||||||
 | 
					Änderungen:
 | 
				
			||||||
 | 
					0.1: 13.12.2024 Erste Version
 | 
				
			||||||
 | 
					0.2: 16.12.2024 Fehlersuche und Code anpassungen
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Einbinden von Headerdateien der Programmbibliothek.
 | 
				
			||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					#include <float.h>
 | 
				
			||||||
 | 
					#include <stdbool.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Mit main beginnt unser Programm.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int Haenchen_Drehmoment_main() {
 | 
				
			||||||
 | 
					// Variablen
 | 
				
			||||||
 | 
					  char input_start[5]; // Inputvariable für Programmstart
 | 
				
			||||||
 | 
					  char input_loop[5]; // Inputvariable für Berechnungsart
 | 
				
			||||||
 | 
					  char input_t[20]; // Inputvariable Drehmoment
 | 
				
			||||||
 | 
					  char input_l[20]; // Inputvariable Wirkungslaenge
 | 
				
			||||||
 | 
					  char input_f[20]; // Inputvariable Kraft
 | 
				
			||||||
 | 
					  int var_return = 0; // Variable zum beenden
 | 
				
			||||||
 | 
					  float value_t = 0; // Umgewandelter Wert Drehmoment
 | 
				
			||||||
 | 
					  float value_l = 0; // Umgewandelter Wert Wirkungslaenge
 | 
				
			||||||
 | 
					  float value_f = 0; // Umgewandelter Wert Kraft
 | 
				
			||||||
 | 
					  float output_t = 0; // Outputvariable Drehmoment
 | 
				
			||||||
 | 
					  float output_l = 0; // Outputvariable Wirkungslaenge
 | 
				
			||||||
 | 
					  float output_f = 0; // Outputvariable Kraft
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  // Legende zur Funktionsweise des Unterprogramms wird ausgegeben
 | 
				
			||||||
 | 
					  printf("Herzlich Willkommen zum DREHMOMENTRECHNER!\n");
 | 
				
			||||||
 | 
					  printf("Dieses Unterprogramm laesst sich jederzeit mit der 'Q'-Taste beenden.\n");
 | 
				
			||||||
 | 
					  printf("Willst du ein Drehmoment berechnen?\n Ja oder Nein:\n");
 | 
				
			||||||
 | 
					  scanf("%s", &input_start[0]);
 | 
				
			||||||
 | 
					  while (getchar() != '\n'); // Pufferspeicher leeren
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  if (strcmp(input_start, "Ja") == 0) { // Drehmoment berchnen in While Schlaufe
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					   while (1) {
 | 
				
			||||||
 | 
						  printf("Wenn du das Drehmoment aus Wirkungslaenge und Kraft berechnen willst gib ein: M\n");
 | 
				
			||||||
 | 
						  printf("Wenn du die Wirkungslaenge aus Drehmoment und Kraft berechnen willst gib ein: l\n");
 | 
				
			||||||
 | 
						  printf("Wenn du die kraft aus Drehmoment und Wirkungslaenge berechnen willst gib ein: F\n");
 | 
				
			||||||
 | 
						  scanf("%s",&input_loop[0]);
 | 
				
			||||||
 | 
						  while (getchar() != '\n'); // Pufferspeicher leeren
 | 
				
			||||||
 | 
						  
 | 
				
			||||||
 | 
						  if (strcmp(input_loop, "M") == 0) { // Drehmoment
 | 
				
			||||||
 | 
							  printf("Deine Wirkungslaenge: \n");
 | 
				
			||||||
 | 
							  scanf("%s", &input_l);
 | 
				
			||||||
 | 
							  if (input_l[0] == 'q' || input_l[0] == 'Q') {
 | 
				
			||||||
 | 
								  var_return = 10;
 | 
				
			||||||
 | 
								  break;
 | 
				
			||||||
 | 
							  }
 | 
				
			||||||
 | 
							  printf("Deine Kraft: \n");
 | 
				
			||||||
 | 
							  scanf("%s", &input_f);
 | 
				
			||||||
 | 
							   if (input_f[0] == 'q' || input_f[0] == 'Q') {
 | 
				
			||||||
 | 
								  var_return = 10;
 | 
				
			||||||
 | 
								  break;
 | 
				
			||||||
 | 
							  }
 | 
				
			||||||
 | 
							  value_l = atof(input_l);
 | 
				
			||||||
 | 
					          value_f = atof(input_f);
 | 
				
			||||||
 | 
					          output_t = value_l * value_f;
 | 
				
			||||||
 | 
					          printf("Dein Drehmoment ist: %f\n", output_t);
 | 
				
			||||||
 | 
							  printf("Wenn du kein Drehmoment mehr Berechnen willst gib ein: Genug\n");
 | 
				
			||||||
 | 
							  
 | 
				
			||||||
 | 
						  }
 | 
				
			||||||
 | 
						  
 | 
				
			||||||
 | 
						  else if (strcmp(input_loop, "l") == 0) { // Wirkungslaenge
 | 
				
			||||||
 | 
							  printf("Dein Drehmoment: \n");
 | 
				
			||||||
 | 
							  scanf("%s", &input_t);
 | 
				
			||||||
 | 
							   if (input_t[0] == 'q' || input_t[0] == 'Q') {
 | 
				
			||||||
 | 
								  var_return = 10;
 | 
				
			||||||
 | 
								  break;
 | 
				
			||||||
 | 
							  }
 | 
				
			||||||
 | 
							  printf("Deine Kraft: \n");
 | 
				
			||||||
 | 
							  scanf("%s", &input_f);
 | 
				
			||||||
 | 
							   if (input_f[0] == 'q' || input_f[0] == 'Q') {
 | 
				
			||||||
 | 
								  var_return = 10;
 | 
				
			||||||
 | 
								  break;
 | 
				
			||||||
 | 
							  }
 | 
				
			||||||
 | 
							  value_t = atof(input_t);
 | 
				
			||||||
 | 
					          value_f = atof(input_f);
 | 
				
			||||||
 | 
					          output_l = value_t / value_f;
 | 
				
			||||||
 | 
					          printf("Deine Wirkungslaenge ist: %f\n", output_l);
 | 
				
			||||||
 | 
							  printf("Wenn du kein Drehmoment mehr Berechnen willst gib ein: Genug\n");
 | 
				
			||||||
 | 
							  
 | 
				
			||||||
 | 
						  }
 | 
				
			||||||
 | 
						  
 | 
				
			||||||
 | 
						  else if (strcmp(input_loop, "F") == 0) { // Kraft
 | 
				
			||||||
 | 
							  printf("Dein Drehmoment: \n");
 | 
				
			||||||
 | 
							  scanf("%s", &input_t);
 | 
				
			||||||
 | 
							   if (input_t[0] == 'q' || input_t[0] == 'Q') {
 | 
				
			||||||
 | 
								  var_return = 10;
 | 
				
			||||||
 | 
								  break;
 | 
				
			||||||
 | 
							  }
 | 
				
			||||||
 | 
							  printf("Deine Wirkungslaenge: \n");
 | 
				
			||||||
 | 
							  scanf("%s", &input_l);
 | 
				
			||||||
 | 
							   if (input_l[0] == 'q' || input_l[0] == 'Q') {
 | 
				
			||||||
 | 
								  var_return = 10;
 | 
				
			||||||
 | 
								  break;
 | 
				
			||||||
 | 
							  }
 | 
				
			||||||
 | 
							  value_t = atof(input_t);
 | 
				
			||||||
 | 
					          value_l = atof(input_l);
 | 
				
			||||||
 | 
					          output_f = value_t / value_l;
 | 
				
			||||||
 | 
					          printf("Deine Kraft ist: %f\n", output_f);
 | 
				
			||||||
 | 
							  printf("Wenn du kein Drehmoment mehr Berechnen willst gib ein: Genug\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						  }
 | 
				
			||||||
 | 
						  
 | 
				
			||||||
 | 
					      else if (input_loop[0] == 'q' || input_loop[0] == 'Q') { // Abbruch
 | 
				
			||||||
 | 
							  var_return = 10;
 | 
				
			||||||
 | 
							  break;
 | 
				
			||||||
 | 
						  }
 | 
				
			||||||
 | 
						  
 | 
				
			||||||
 | 
						  else if (strcmp(input_loop, "Genug") == 0) { // Abbruch
 | 
				
			||||||
 | 
							  var_return = 0;
 | 
				
			||||||
 | 
							  break;
 | 
				
			||||||
 | 
						  }
 | 
				
			||||||
 | 
						  
 | 
				
			||||||
 | 
						  else { // Falsche Eingabe
 | 
				
			||||||
 | 
							  printf("Du huere sautubel du, aes hett gheisse: M,l,F / Genug!\n");
 | 
				
			||||||
 | 
							  var_return = 20;
 | 
				
			||||||
 | 
							  break;
 | 
				
			||||||
 | 
						  }
 | 
				
			||||||
 | 
					   }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  else if (strcmp(input_start, "Nein") == 0) { //Beenden des Programms
 | 
				
			||||||
 | 
						  var_return = 0;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  else if (input_start[0] == 'q' || input_start[0] == 'Q') { // Abbruch
 | 
				
			||||||
 | 
						  var_return = 10;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  else { // Falsche Eingabe
 | 
				
			||||||
 | 
						  printf("Du huere sautubel du, aes isch ae Ja/Nei frag!\n");
 | 
				
			||||||
 | 
						  var_return = 20;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  // Präprozessoranweisung (Linux oder Windows?)
 | 
				
			||||||
 | 
					  #ifndef __linux__ // Hält die Konsole offen.
 | 
				
			||||||
 | 
					  system("pause");
 | 
				
			||||||
 | 
					  #endif
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  // Rückgabewert, dass das Programm erfolgreich beendet wurde.
 | 
				
			||||||
 | 
					  return var_return;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										7
									
								
								src/Haenchen-vz/Haenchen_Drehmoment.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/Haenchen-vz/Haenchen_Drehmoment.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					#ifndef HAENCHEN_DREHMOMENT_H_ 
 | 
				
			||||||
 | 
					#define HAENCHEN_DREHMOMENT_H_ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   int Haenchen_Drehmoment_main();
 | 
				
			||||||
 | 
					   
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										22
									
								
								src/main.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								src/main.c
									
									
									
									
									
								
							@ -36,6 +36,7 @@ Datum: 04.12.2024
 | 
				
			|||||||
#include "Wein-tz/Abbildungsrechner.h"
 | 
					#include "Wein-tz/Abbildungsrechner.h"
 | 
				
			||||||
#include "Flugi-tz/Funktion_Flugi.h"
 | 
					#include "Flugi-tz/Funktion_Flugi.h"
 | 
				
			||||||
#include "Wein-vz/InformatikZusammenfassung.h"
 | 
					#include "Wein-vz/InformatikZusammenfassung.h"
 | 
				
			||||||
 | 
					#include "Haenchen-vz/Haenchen_Drehmoment.h"
 | 
				
			||||||
#include "test_prog.h"
 | 
					#include "test_prog.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "Main-vz/pipes_test.h"
 | 
					#include "Main-vz/pipes_test.h"
 | 
				
			||||||
@ -188,17 +189,17 @@ void print_menu(int terminal_width, int terminal_height, int line){
 | 
				
			|||||||
        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (1 <= line && line < 3) ? ";31": ";37");
 | 
					        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (1 <= line && line < 3) ? ";31": ";37");
 | 
				
			||||||
        print_line("┃  3 Informatik                    (vz) ┃", spaces, (2 <= line && line < 3) ? ";31": ";37");
 | 
					        print_line("┃  3 Informatik                    (vz) ┃", spaces, (2 <= line && line < 3) ? ";31": ";37");
 | 
				
			||||||
        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (2 <= line && line < 4) ? ";31": ";37");
 | 
					        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (2 <= line && line < 4) ? ";31": ";37");
 | 
				
			||||||
        print_line("┃  4                               (vz) ┃", spaces, (3 <= line && line < 4) ? ";31": ";37");
 | 
					        print_line("┃  4 Drehmoment                    (vz) ┃", spaces, (3 <= line && line < 4) ? ";31": ";37");
 | 
				
			||||||
        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (3 <= line && line < 5) ? ";31": ";37");
 | 
					        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (3 <= line && line < 5) ? ";31": ";37");
 | 
				
			||||||
        print_line("┃  5 Abbildungsrechner             (tz) ┃", spaces, (4 <= line && line < 5) ? ";31": ";37");
 | 
					        print_line("┃  5                               (vz) ┃", spaces, (4 <= line && line < 5) ? ";31": ";37");
 | 
				
			||||||
        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (4 <= line && line < 6) ? ";31": ";37");
 | 
					        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (4 <= line && line < 6) ? ";31": ";37");
 | 
				
			||||||
        print_line("┃  6 Numpy                         (tz) ┃", spaces, (5 <= line && line < 6) ? ";31": ";37");
 | 
					        print_line("┃  6 Abbildungsrechner             (tz) ┃", spaces, (5 <= line && line < 6) ? ";31": ";37");
 | 
				
			||||||
        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (5 <= line && line < 7) ? ";31": ";37");
 | 
					        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (5 <= line && line < 7) ? ";31": ";37");
 | 
				
			||||||
        print_line("┃  7 Programm                      (tz) ┃", spaces, (6 <= line && line < 7) ? ";31": ";37");
 | 
					        print_line("┃  7 Numpy                         (tz) ┃", spaces, (6 <= line && line < 7) ? ";31": ";37");
 | 
				
			||||||
        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (6 <= line && line < 8) ? ";31": ";37");
 | 
					        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (6 <= line && line < 8) ? ";31": ";37");
 | 
				
			||||||
        print_line("┃  8 Programm                           ┃", spaces, (7 <= line && line < 8) ? ";31": ";37");
 | 
					        print_line("┃  8                               (tz) ┃", spaces, (7 <= line && line < 8) ? ";31": ";37");
 | 
				
			||||||
        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (7 <= line && line < 9) ? ";31": ";37");
 | 
					        print_line("┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫", spaces, (7 <= line && line < 9) ? ";31": ";37");
 | 
				
			||||||
        print_line("┃  9 Programm                           ┃", spaces, (8 <= line && line < 9) ? ";31": ";37");
 | 
					        print_line("┃  9                               (tz) ┃", spaces, (8 <= line && line < 9) ? ";31": ";37");
 | 
				
			||||||
        print_line("┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛", spaces, (8 <= line && line < 9) ? ";31": ";37");
 | 
					        print_line("┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛", spaces, (8 <= line && line < 9) ? ";31": ";37");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -246,13 +247,12 @@ void run_programm(int programm, int width, int height, bool *used){
 | 
				
			|||||||
        case 0: return_code = Ramen_Physik(); break;
 | 
					        case 0: return_code = Ramen_Physik(); break;
 | 
				
			||||||
        case 1: return_code = Fehlenden_Elektronik_main(); break;
 | 
					        case 1: return_code = Fehlenden_Elektronik_main(); break;
 | 
				
			||||||
        case 2: return_code = Informatik_main(); break;
 | 
					        case 2: return_code = Informatik_main(); break;
 | 
				
			||||||
        case 3: return_code = test_gruppe_programmname(); break;
 | 
					        case 3: return_code = Haenchen_Drehmoment_main(); break;
 | 
				
			||||||
        case 4: return_code = Abbildungsrechner(); break;
 | 
					        case 4: return_code = test_gruppe_programmname(); break;
 | 
				
			||||||
        case 5: return_code = Flugi(); break;
 | 
					        case 5: return_code = Abbildungsrechner(); break;
 | 
				
			||||||
        case 6: return_code = test_gruppe_programmname(); break;
 | 
					        case 6: return_code = Flugi(); break;
 | 
				
			||||||
        case 7: return_code = test_gruppe_programmname(); break;
 | 
					        case 7: return_code = test_gruppe_programmname(); break;
 | 
				
			||||||
        case 8: return_code = test_gruppe_programmname(); break;
 | 
					        case 8: return_code = test_gruppe_programmname(); break;
 | 
				
			||||||
        case 9: return_code = test_gruppe_programmname(); break;
 | 
					 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // ist dazu da um "\n" aus dem buffer zu entfernen!
 | 
					    // ist dazu da um "\n" aus dem buffer zu entfernen!
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user