为什么这个无法正常结束啊(while)
#include<stdio.h>int main()
{
int flag;
float p1,p2,q,T,a,b;
scanf("%d",&T);
while(T--)
{
scanf("%d %f %f %f %d",&a,&p1,&p2,&q,&b);
if(p2*a/(1-p2)<b/(1-q)-a)
{
flag=0;
}
else if(p2*a/(1-p2)>=b/(1-q)-a)
{
flag = 1;
}
if(flag)
{
printf("We are best friends!\n");
}
else
{
printf("Need more Green Tea?\n");
}
}
return 0;
} #include<stdio.h>
int main()
{
int flag,T; //把T改成int试试
float p1, p2, q, a, b;
scanf("%d", &T);
while (T--)
{
scanf("%d %f %f %f %d", &a, &p1, &p2, &q, &b);
if (p2 * a / (1 - p2) < b / (1 - q) - a)
{
flag = 0;
}
else if (p2 * a / (1 - p2) >= b / (1 - q) - a)
{
flag = 1;
}
if (flag)
{
printf("We are best friends!\n");
}
else
{
printf("Need more Green Tea?\n");
}
}
return 0;
}
页:
[1]