From c9c519066287ff1d73cf06f38d11087237b9c7d3 Mon Sep 17 00:00:00 2001 From: fdai7782 Date: Thu, 1 Feb 2024 12:26:57 +0000 Subject: [PATCH] Added display menu functionality --- src/main/c/main_taschenrechner.c | 18 +++++++++++++++++- src/main/c/taschenrechner.h | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/c/main_taschenrechner.c b/src/main/c/main_taschenrechner.c index d4549dc..c64ab30 100644 --- a/src/main/c/main_taschenrechner.c +++ b/src/main/c/main_taschenrechner.c @@ -6,7 +6,7 @@ int add(int a, int b) { - return a+b; + return a + b; } int minus (int a, int b){ @@ -47,4 +47,20 @@ int mode(int userChoice){ } +} + + +// display the mode options: + +int displayMenu(){ + + printf("\nCalculator Modes: \n"); + printf("\n1: Basic Mode\n"); + printf("\n2: Scientific Mode (Trigonomertic functions, Logarithm and exponential functions.)\n"); + printf("\n3: Graph Mode (Draw and visualize functions.)\n"); + printf("\n4: Programming Mode (Binary , octal and hexadecimal )\n"); + printf("\n5: Unit converter Mode (length, weight volume etc.)\n"); + printf("\n0: Exit calculator\n"); + + return 1; // return 1 to check if the function works } \ No newline at end of file diff --git a/src/main/c/taschenrechner.h b/src/main/c/taschenrechner.h index d410b22..5bbfe6b 100644 --- a/src/main/c/taschenrechner.h +++ b/src/main/c/taschenrechner.h @@ -11,4 +11,6 @@ int divide(int a, int b); int mode(int userChoice); +int displayMenu(); + #endif // TASCHENRECHNER_H