Skip to content
Snippets Groups Projects
Commit ca2e61e6 authored by Luca Michael Schmidt's avatar Luca Michael Schmidt
Browse files

Hinzufügen Woche 10

parents
Branches
Tags
No related merge requests found
# Mindestens erforderlich CMake Version angeben
cmake_minimum_required(VERSION 3.10)
# Projektname und Sprache festlegen
project(pythagorasProject LANGUAGES C)
# Erzeuge die ausführbare Datei aus den Quellcode-Dateien
add_executable(pythagoras main.c pythagoras.c)
# add_executable(pythagoras main.c pythagoras.c pythagoras.h)
# Linke die Math-Bibliothek mit der erzeugten ausführbaren Datei
target_link_libraries(pythagoras PRIVATE m)
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.31
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Disable VCS-based implicit rules.
% : %,v
# Disable VCS-based implicit rules.
% : RCS/%
# Disable VCS-based implicit rules.
% : RCS/%,v
# Disable VCS-based implicit rules.
% : SCCS/s.%
# Disable VCS-based implicit rules.
% : s.%
.SUFFIXES: .hpux_make_needs_suffix_list
# Command-line flag to silence nested $(MAKE).
$(VERBOSE)MAKESILENT = -s
#Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /opt/homebrew/bin/cmake
# The command to remove a file.
RM = /opt/homebrew/bin/cmake -E rm -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/Luca/Documents/Projekte/programmiermethoden/lerntagebuch/W10
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/Luca/Documents/Projekte/programmiermethoden/lerntagebuch/W10
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake cache editor..."
/opt/homebrew/bin/ccmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..."
/opt/homebrew/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /Users/Luca/Documents/Projekte/programmiermethoden/lerntagebuch/W10/CMakeFiles /Users/Luca/Documents/Projekte/programmiermethoden/lerntagebuch/W10//CMakeFiles/progress.marks
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /Users/Luca/Documents/Projekte/programmiermethoden/lerntagebuch/W10/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast
# clear depends
depend:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
#=============================================================================
# Target rules for targets named pythagoras
# Build rule for target.
pythagoras: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 pythagoras
.PHONY : pythagoras
# fast build rule for target.
pythagoras/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/pythagoras.dir/build.make CMakeFiles/pythagoras.dir/build
.PHONY : pythagoras/fast
main.o: main.c.o
.PHONY : main.o
# target to build an object file
main.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/pythagoras.dir/build.make CMakeFiles/pythagoras.dir/main.c.o
.PHONY : main.c.o
main.i: main.c.i
.PHONY : main.i
# target to preprocess a source file
main.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/pythagoras.dir/build.make CMakeFiles/pythagoras.dir/main.c.i
.PHONY : main.c.i
main.s: main.c.s
.PHONY : main.s
# target to generate assembly for a file
main.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/pythagoras.dir/build.make CMakeFiles/pythagoras.dir/main.c.s
.PHONY : main.c.s
pythagoras.o: pythagoras.c.o
.PHONY : pythagoras.o
# target to build an object file
pythagoras.c.o:
$(MAKE) $(MAKESILENT) -f CMakeFiles/pythagoras.dir/build.make CMakeFiles/pythagoras.dir/pythagoras.c.o
.PHONY : pythagoras.c.o
pythagoras.i: pythagoras.c.i
.PHONY : pythagoras.i
# target to preprocess a source file
pythagoras.c.i:
$(MAKE) $(MAKESILENT) -f CMakeFiles/pythagoras.dir/build.make CMakeFiles/pythagoras.dir/pythagoras.c.i
.PHONY : pythagoras.c.i
pythagoras.s: pythagoras.c.s
.PHONY : pythagoras.s
# target to generate assembly for a file
pythagoras.c.s:
$(MAKE) $(MAKESILENT) -f CMakeFiles/pythagoras.dir/build.make CMakeFiles/pythagoras.dir/pythagoras.c.s
.PHONY : pythagoras.c.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... rebuild_cache"
@echo "... pythagoras"
@echo "... main.o"
@echo "... main.i"
@echo "... main.s"
@echo "... pythagoras.o"
@echo "... pythagoras.i"
@echo "... pythagoras.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system
W10/images/i1.png

25.6 KiB

W10/images/i2.png

26.1 KiB

W10/images/i3.png

83.4 KiB

W10/images/i4.png

69.7 KiB

#include <stdio.h>
#include "pythagoras.h"
int main() {
double a, b, c;
printf("Gib die Länge der ersten Kathete ein: ");
scanf("%lf", &a);
printf("Gib die Länge der zweiten Kathete ein: ");
scanf("%lf", &b);
// Berechne die Hypotenuse mithilfe der Funktion aus pythagoras.c
c = calculateHypotenuse(a, b);
printf("Die Länge der Hypotenuse ist %.2f\n", c);
return 0;
}
\ No newline at end of file
#include "pythagoras.h"
#include <math.h>
double calculateHypotenuse(double a, double b) {
return sqrt(a * a + b * b);
}
\ No newline at end of file
#ifndef PYTHAGORAS_H
#define PYTHAGORAS_H
double calculateHypotenuse(double a, double b);
#endif // PYTHAGORAS_H
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment