diff --git a/src/main/c/main_taschenrechner.c b/src/main/c/main_taschenrechner.c index 526d9e9..7645288 100644 --- a/src/main/c/main_taschenrechner.c +++ b/src/main/c/main_taschenrechner.c @@ -22,9 +22,10 @@ int divide(int a, int b) { return a / b; } +// // scientificmode -int scientificmode(){ +int scientificMode(){ double num, result; @@ -62,6 +63,25 @@ int scientificmode(){ return result; } +// graphMode +void graphMode() { + double x, y; + + printf("Enter the range for x (start end step): "); + double x_start, x_end, x_step; + scanf("%lf %lf %lf", &x_start, &x_end, &x_step); + + printf("\nGraph for the function y = sin(x):\n"); + + printf(" x\t| y\n"); + printf("--------------\n"); + + for (x = x_start; x <= x_end; x += x_step) { + y = sin(x); + printf("%.2lf\t| %.2lf\n", x, y); + } +} + // change mode int mode(int userChoice){