Re: How do I limit user entry choices?
From: Barry Schwarz (schwarzb_at_deloz.net)
Date: 03/02/04
- Next message: Brian MacBride: "Re: Or may be crashing here"
- Previous message: Barry Schwarz: "Re: Help with case construct"
- In reply to: Benjamin: "Re: How do I limit user entry choices?"
- Next in thread: Benjamin: "Re: How do I limit user entry choices?"
- Reply: Benjamin: "Re: How do I limit user entry choices?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 2 Mar 2004 04:53:34 GMT
On Tue, 02 Mar 2004 00:41:34 GMT, Benjamin <benkong2@msn.com> wrote:
snip 120 lines of obsolete code
>
>#include <stdio.h>
>#include <ctype.h>
>
>#define British_Pound '1'
>#define Canadian_Dollar '2'
>#define Euros '3'
>#define Yen '4'
>#define Franc '5'
>#define Quit 'Q'
>
>void do_pounds(void)
>{
>
>
> puts("\nthis works");
>}
>
>void discard(void)
>{
> int c=0;
>
> while ((c = getchar()) !=EOF && c !='\n');
>
>}
>
>int err (int d)
>{
> puts("Invalid choice, try again\n");
>
> if (d)
> discard();
> return 0;
>
>}
>
>int menu()
>{
> int choice = 0;
>
> while(!choice)
> {
>
> printf("%c. %s\n",British_Pound,"British_Pound");
>
> printf("Choice? ");
> fflush(stdout);
> if ((choice - getchar()) !=EOF)
Did you mean choice = getchar()? I hope so because what you wrote
makes no sense. Did you cut and paste your program or retype it? If
this is your actual code, choice never gets updated which explains the
error message.
snip rest of code
<<Remove the del for email>>
- Next message: Brian MacBride: "Re: Or may be crashing here"
- Previous message: Barry Schwarz: "Re: Help with case construct"
- In reply to: Benjamin: "Re: How do I limit user entry choices?"
- Next in thread: Benjamin: "Re: How do I limit user entry choices?"
- Reply: Benjamin: "Re: How do I limit user entry choices?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|