求大佬讲解,这样写为什么不行
#include <stdio.h>
int main()
{
int n;
int color;
int rp=0,yp=0;
printf("请输入击球次数与击球颜色:\n");
scanf("%d",&n);
while(color=getchar()&&n!=0)
{
if(color=='R')
{
++rp;
}
if(color='Y')
{
++yp;
}
if(color=='B')
{
rp+=8;
}
if(color=='L')
{
yp+=8;
}
--n;
}
if(rp==15)
{
printf("Red");
}
else{
if(rp>7)
{
printf("Yellow");
}
}
if(yp==15)
{
printf("Yellow");
}
else{
if(yp>7)
{
printf("Red");
}
}
return 0;
}