From 8d69bf6c8ff17a3467b228cb6c6215dc95c7c345 Mon Sep 17 00:00:00 2001 From: fdai7782 Date: Fri, 2 Feb 2024 15:18:30 +0000 Subject: [PATCH] Added sineFunction 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 60e57f1..f407180 100644 --- a/src/main/c/main_taschenrechner.c +++ b/src/main/c/main_taschenrechner.c @@ -22,6 +22,12 @@ int divide(int a, int b) { return a / b; } +// Trigonometric functions +double sineFunction(double angle) { + // Convert degrees to radians for trigonometric functions + return sin(angle * M_PI / 180.0); +} + // scientificmode diff --git a/src/main/c/taschenrechner.h b/src/main/c/taschenrechner.h index 5bbfe6b..1ca10c6 100644 --- a/src/main/c/taschenrechner.h +++ b/src/main/c/taschenrechner.h @@ -9,6 +9,8 @@ int multiply(int a, int b); int divide(int a, int b); +double sineFunction(double angle); + int mode(int userChoice); int displayMenu();