Re: Currency conversion program



On 5 Sep 2005 11:54:12 -0700, "Just starting out"
<kelli.pitts@xxxxxxxxx> wrote:

>Flash,
>
>Thanks for your feedback!
>
>I'm using Miracle C compiler for my assignments.
>
>I'm not sure what you mean by ending the printf statement with a new
>line or flush stdout. I wanted the user input to appear at the end of
>the "Please enter a number: " line. I checked my book for flush stdout
>and it looks like I need a new book.

You have to provide some context. What code are you talking about.
The fact that the google interface is broken means you have to do it
manually.

The function you want is fflush. What book are you using?

>
>I replaced my original scanf with the "while(scanf..." code that
>kernelxu suggested. The two printf lines both print according to the
>number of letters the user enters. (ex. user enters STOP, the printf
>lines both print 4 times).
>
>Our class was told to use getch(); function in order to keep the window

I would be better if you were told to use a standard function like
getchar(). Not everyone has non-standard extensions like getch().

>from automatically closing. Maybe it's a Miracle C thing.

No, it's a Windows thing. When main() returns, your window may close
before you can see its contents. Putting a getchar() prior to the
return is intended to insure the window stays open until you hit Enter
signifying you are done looking.


<<Remove the del for email>>
.



Relevant Pages

  • Re: How to prevent the quick disappearance of window
    ... on Window XP. ... This is not a valid preprocessor statement. ... printf("I am alive! ... Add a getchar() just before the return from main. ...
    (comp.lang.c)
  • Re: basics
    ... As for using printf rather than puts, ... console window, run the program, and then close the window before you can ... Stupid stupid stupid. ... Just teach them how to use a console ...
    (comp.lang.c)
  • Re: Why does console window appear
    ... that is displayed or for printf or cout. ... > Any advice how to quickly track down the offending statement? ... >> At a guess, the program is opening the window, either because it's ... >> Paul T. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Forth stdin and stdout
    ... It will open a DOS console and a window. ... Parameters to Windows calls in Win32Forth are passed in reverse order. ... Your printf example would be ...
    (comp.lang.forth)
  • Re: Why does console window appear
    ... The device is a Dell Axim x3i Pocket PC. ... So if I do a printf or std::cout. ... this window??? ...
    (microsoft.public.windowsce.embedded.vc)