What's the best way to do a "Do you want to continue"?
I tried the "Do you want to continue? y/n", every time an error comes up with something to do with the characters.
Please help
What's the best way to do a "Do you want to continue"?
I tried the "Do you want to continue? y/n", every time an error comes up with something to do with the characters.
Please help
There are some tips on how to pause a program in the board FAQ, if nothing there suggests a solution to your, (somewhat cryptic), problem, post your code.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
There are two functions you could use that are under the
#<ctype.h> & <conio.h> header files
main90
{
char ch;
printf("\n Do you want to continue >");
ch = getch(ch);
ch=toupper(ch);
if(ch == 'Y')
{
/*do some coding*/
}
else
exti(1); /*this is in the stdlib.h*/
Before you judge a man, walk a mile in his
shoes. After that, who cares.. He's a mile away and you've got
his shoes.
************William Connoly
Code:char Key='y'; while(Key=='y') { ... printf("Do you want to continue? y/n); scanf(&Key); //Not sure about the exact syntax :) }
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
I know, scanf() is a little bit rusty for me . I see that I forgot a " too, but I'm pretty sure that the general structure works...
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
Code:WORKING-STORAGE SECTION. 77 DO-YOU-WANT-TO-CONTINUE PIC X VALUE "Y".
Always interesting to see other languages, (even COBOL), but hardly applicable to the C board.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.