| |

VerySource

 Forgot password?
 Register
Search
View: 790|Reply: 2

Questions about standard input in C

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-3-17 13:30:01
| Show all posts |Read mode
There is a question, do it well with C ++
What can I do wrong when using C? Later, I found that it was a problem with the input when debugging. C didn't know much ...
Wrote a paragraph
int main ()
{
        double a;
        scanf ("% f",&a);
        printf ("% f", a);
        return 0;
}

Whatever the input is, the output is 0.0000000 (in the case of small numbers). What is wrong?
Reply

Use magic Report

0

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-6-19 11:30:01
| Show all posts
The format of double is %lf, just change it

       double a;
        scanf("%lf",&a);
        printf("%lf", a);
Reply

Use magic Report

0

Threads

63

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-6-19 11:45:01
| Show all posts
scanf("%lf",&a);
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list