I am trying to display the answer that is passed to the function til enter is pressed.The output is gone before i can see it.
void answer(int p[][numCols],int count)
{
printf("\n");
printf("Please press enter to end");
printf("The answer is : %i",p[count][3]);
char c=getchar();
while (c != '\n')
{
c=getchar();
}
}
The code is available here: https://codereview.stackexchange.com/questions/9419/programming-of-3-x-7-trick
I am using Microsoft Visual Studio Ulimate 2010. Need some guidance how to solve it.
Try this function answer :
void answer(int p[][numCols],int count)
{
char c;
printf("\n");
printf("Please press enter to end");
printf("The answer is : %i",p[count][3]);
while((c = getchar()) != '\n')
;
}
And you can try another useful function named sleep();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.