Home > Back-end >  Which master to help give directions under the C language code
Which master to help give directions under the C language code

Time:09-20

why I every time no matter what type the following code digital press enter only perform printf (" BBBBB \ n ") this one line of code? Over and can't find where is wrong, a great god answers, appreciate ~!!

[/size]

#include
#include

Int main (void)
{
Double delta;


Printf (" please input the value of the delta, delta=", delta);
The scanf (" % d ", & amp; The delta);

If (delta & gt; 2)

Printf (" AAAAA \ n ");

Else if (delta & lt;=2 & amp; & The delta & gt; 0)

Printf (" BBBBB \ n ");

Else if (delta==0)

Printf (" CCCCC \ n ");
The else

Printf (" DDDDD \ n ");


return 0;
}

CodePudding user response:

Later I found that if I put the delta data types defined by float can run properly, but if defined as double operation error, don't know what's the problem??

CodePudding user response:

The scanf (" % d ", & amp; The delta);
% d is the input integer

CodePudding user response:

reference 1/f, I am your body response:
I found later, if I put the delta data types defined by float can run properly, but if defined as double operation error, don't know what's the problem??
in c language, used by different types of data in input and output of different placeholders, the type of data type double with lf %, when the input (the scanf) in the output (printf) with lf % or % f; Float type of input and output are used f %; Int types of data input and output by d %, the hope can help you,

CodePudding user response:

reference LEandLA reply: 3/f
Quote: refer to the body of the 1/f, I am your response:
later I found that if I put the delta data types defined by float can run properly, but if defined as double operation error, don't know what's the problem??
in c language, used by different types of data in input and output of different placeholders, the type of data type double with lf %, when the input (the scanf) in the output (printf) with lf % or % f; Float type of input and output are used f %; Int types of data input and output by d %, the hope can help you,
% in the former, embarrassed,
  • Related