[英]How to make the output stay on the screen for a period of time in Win32 app
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 可以在这里找到代码: 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. 我正在使用Microsoft Visual Studio Ulimate2010。需要一些指导来解决它。
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(); 您可以尝试另一个有用的函数,该函数名为sleep();。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.