void main()
{
double i;
while(1)
{
printf("請輸入員工的銷售額(元):");
printf("%lf",i);system("pause");
scanf("%lf",&i); //若這裏輸入的是字符型,a,dsfr,等,將會使鍵盤緩衝區堵塞,scanf不回讀取任何數據而執行下面的代碼。
// fflush(stdin); //將鍵盤緩衝區清空
printf("%lf",i);system("pause");
if(i>=0)
{
break;
system("pause");
}
else
{
printf("你輸入有誤請重新輸入");
}
}
}