I wrote a calculator program in visual studio. But i need it to run with also DEVC++. But my code doesn't work on gcc compiler. Here is a little part of the code that doesn't work.
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdbool.h>
int main(){
long double var1 = 0, var2= 0, memory, result;
char wordInput[50] = { 0 };
char *endPtr1, *endPtr2;
printf("Enter an input: ";
scanf("%[^\n]%*c", wordInput);
var1 = strtold(wordInput, &endPtr1);
printf("%.4f", var1);
}
This is the block of code where i get the input and convert it to double and assign to the var1. When i compile it with visual studio it works(it prints the number which is entered) but with devc++ it doesn't (it prints 0.0000). What can i do to fix it?
BLUEPIXY :
try this\n\n#define __USE_MINGW_ANSI_STDIO 1\n#include <stdio.h>\n\n....\n\n printf(\"%.4Lf\", var1);\n",
2015-04-17T22:15:54