Browse Source

Added graph mode for testing with basic sin function table

remotes/origin/feature
fdai7782 11 months ago
parent
commit
97217b687c
  1. 22
      src/main/c/main_taschenrechner.c

22
src/main/c/main_taschenrechner.c

@ -22,9 +22,10 @@ int divide(int a, int b) {
return a / b; return a / b;
} }
//
// scientificmode // scientificmode
int scientificmode(){
int scientificMode(){
double num, result; double num, result;
@ -62,6 +63,25 @@ int scientificmode(){
return result; 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 // change mode
int mode(int userChoice){ int mode(int userChoice){

Loading…
Cancel
Save