为什么fflush(..)不工作,c2和c0?
如果我使用声明c0 = 0并且c2 = 0它可以工作,但是fflush(stdin)不起作用,我试图放在不同的地方,但它没有用,我在ubuntu 13.04中使用代码块;
int main(void)
{
int cod ,passou = 0, c0, c1, c2, c3, ct;
float p1, p2, p3;
char o;
do {
puts ("Informe codigo: ");
scanf ("%i", &cod);
fflush (stdin);
switch (cod)
{
case 0:
c0 = c0 + 1;
break;
case 1:
c1 = c1 + 1;
ct = ct + 1;
break;
case 2:
c2 = c2 + 1; …Run Code Online (Sandbox Code Playgroud)