From 5e548b90e558e2a3a232706fc7ee42cf4aa7e20f Mon Sep 17 00:00:00 2001 From: fdai7782 Date: Fri, 2 Feb 2024 15:21:46 +0000 Subject: [PATCH] Added cosine function for trigonometric calculations --- src/main/c/main_taschenrechner.c | 6 ++++++ src/main/c/taschenrechner.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/main/c/main_taschenrechner.c b/src/main/c/main_taschenrechner.c index f407180..d99a933 100644 --- a/src/main/c/main_taschenrechner.c +++ b/src/main/c/main_taschenrechner.c @@ -29,6 +29,12 @@ double sineFunction(double angle) { } +double cosineFunction(double angle) { + // Convert degrees to radians for trigonometric functions + return cos(angle * M_PI / 180.0); +} + + // scientificmode int scientificMode(){ diff --git a/src/main/c/taschenrechner.h b/src/main/c/taschenrechner.h index 1ca10c6..a5b9d40 100644 --- a/src/main/c/taschenrechner.h +++ b/src/main/c/taschenrechner.h @@ -11,6 +11,8 @@ int divide(int a, int b); double sineFunction(double angle); +double cosineFunction(double angle); + int mode(int userChoice); int displayMenu();