I can't disable scientific notation... I'd like to print on screen the exact value of the numbers instead of the scientific notation. It's my first project in C. It's a simple calculator it's just a prototype, I'd like to create a very complex program starting from this. Any help or tips will be really appreciated. Thanks for your support.
#include <math.h>
#include <stdio.h>
#define ADD(a, b) (a += b)
#define SOT(a, b) (a -= b)
#define PER(a, b) (a *= b)
#define DIV(a, b) (a /= b)
#define POT(a, b) a = pow(a, b)
#define LOG(a, b) a = (log10(a) / log10(b))
#define PERC(a) a = (a / 100)
{
float a, b, d;
static float e;
char c, g;
printf("Calcola \n");
scanf("%g", &a);
while (1) {
e = a;
scanf(" %c", &c);
switch (c) {
case '+':
scanf("%g", &b);
system("clear");
d = ADD(a, b);
printf(" \n Risultato \n \n");
printf("(%g+%g)=", e, b);
printf("%g", d);
break;
case '-':
scanf("%g", &b);
system("clear");
d = SOT(a, b);
printf(" \n Risultato \n \n");
printf("(%g-%g)=", e, b);
printf("%g", d);
break;
case '*':
scanf("%g", &b);
system("clear");
d = PER(a, b);
printf(" \n Risultato \n \n");
printf("(%g*%g)=", e, b);
printf("%g ", d);
break;
case '/':
scanf("%g", &b);
system("clear");
d = DIV(a, b);
printf(" \n Risultato \n \n");
printf("(%g/%g)=", e, b);
printf("%g", d);
break;
case '^':
scanf("%g", &b);
system("clear");
d = POT(a, b);
printf(" \n Risultato \n \n");
printf("(%g^%g)=", e, b);
printf("%g", d);
break;
case 'l':
scanf("%g", &b);
system("clear");
d = LOG(a, b);
printf(" \n Risultato \n \n");
printf("(%glog%g)=", e, b);
printf("%g", d);
break;
case '%':
system("clear");
d = PERC(a);
printf(" \n Risultato \n \n");
printf("%g%=", e);
printf("%g", d);
break;
}
}
return 0;
}