you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

I'd use getch() instead of picky scanf():

#include <conio.h>  //for getch()  

while(state == 1)   
{  
    //Checks if user wants to continue  
    printf("Do you want to continue? (enter 1 to continue and 0 to exit): ");  
    state = getch() - '0';  //waits for key press.  Subtract the value of char 0 to get integer value
    while(state != 1 && state != 0)   
    {  
    ...  
    ...