Home > Back-end >  Why write a second input is very strange
Why write a second input is very strange

Time:02-22

#include

Int main ()
{
Char s [20] [100], I=0;
Double a;
Int t=3;
While (t -)
{
[I] gets (s);
Lf the scanf (" % ", & amp; a);
Printf (" % f \ n ", a); [I] puts (s);
i++;
}
return 0;
}

CodePudding user response:

Buffer have extra characters, modified as follows, for reference:
 # include 
Int main (int arg c, char * argv [])
{
Char s [20] [100], I=0;
Double a;
Int t=3;
While (t -)
{
[I] gets (s);
Lf the scanf (" % ", & amp; a);
Getchar ();
Printf (" % f \ n ", a); [I] puts (s);
i++;
}

return 0;
}
  • Related