求教大佬,为啥vs编译器执行不了do-while循环??
先装的vs2017,结果发现do-while无法循环,以为是编译器的毛病,又装了vs2015,结果还是不行,请问这是咋回事呀?代码如下
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char yn = 0;
int a = 0, b = 0;
do
{
printf("Enter a value:");
scanf_s(" %d", &a);
b = a*a;
printf(" %d \n\n", b);
printf("Again?(y/n)");
scanf_s(" %c", &yn);
} while (yn == 'y' || yn == 'Y');
printf("Byebye..\n\n");
system("pause");
return 0;
}
另外,同样的代码用vc6编译就完全没问题,为什么vs系列用不了do-while呀?