I've written a program with a lot of if sections.It´s written with Visual Studio 2013(scanf_s).
It skips some if sections though these are met. Can you please tell me why?
My suspicion: The first scanf command is executed cleanly. The other scanf commands don't work. I can't input anything. The program goes strictly on. When I insert fflush(stdin) between the scanf commands, it works. I heard bad things about fflsuh because of this I wanna ask: How can I solve it in another way?
Here is my code:
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
int _tmain(int argc, _TCHAR* argv[])
{
char versand='n', stammkunde='t';
double warenwert=1;
printf("Wieviel kostet die Ware?");
scanf_s("%lf", &warenwert);
fflush(stdin);
printf("Wird die Ware abgeholt?(y,n)");
scanf_s("%c", &versand);
if (versand == 'n')
{
    if (warenwert < 100)
    {
        warenwert = warenwert + 7;
    }
    printf("Expressversand?(y,n");
    scanf_s("%c", &versand);
        //fflush(stdin); 
    if (versand == 'y')
    {
        warenwert = warenwert + 10;
    }
}
printf("Stammkunde?(y,n)");
scanf_s("%c", &stammkunde);
if (stammkunde = 'y')
{
    warenwert = warenwert * 0, 97;
}
printf("Endpreis inkl. Versandkosten:%lf", warenwert);
getchar();
return 0;
}
P.S: Program output screenshot here: http://i.gyazo.com/01471ce3d563837f526fbcab8363e1f2.png
 
     
     
    