[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [h-e-w] printf order in emacs shells
From: |
Jason Rumney |
Subject: |
Re: [h-e-w] printf order in emacs shells |
Date: |
Mon, 27 Jun 2011 23:33:58 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Sayth Renshaw <address@hidden> writes:
> # include <stdio.h>
> int main()
> {
> float a,b,c,interest;
> printf("Type in amount in dollars cents:\n");
fflush(stdout);
> scanf("%f",&a);
> b = 0.075;
> c = a * b;
> interest = a + c;
> printf("The total including interest is $%.2f", interest);
> return 0;
> }
Windows automatically flushes the output before a scanf if stdout/stdin
is a console window, but it does not if they are redirected to another
program.