/* ex02-05.c */
#include <stdio.h>
#include <string.h>
int main (void)
{
char buffer[256];
printf( "Enter your name and press <Enter>:\n" );
gets ( buffer );
printf( "\nYour name has %d characters and spaces!",
strlen( buffer ) )
return 0
}
第1个回答 推荐于2017-10-03
你确定是按照书上写的?输出后面漏了一个分号= =。
下面的代码你试试
#include <stdio.h>
#include <string.h>
int main (void)
{
char buffer[256];
printf( "Enter your name and press <Enter>:\n" );
gets ( buffer );
printf( "\nYour name has %d characters and spaces!",
strlen( buffer ) );
}本回答被提问者采纳
下面的代码你试试
#include <stdio.h>
#include <string.h>
int main (void)
{
char buffer[256];
printf( "Enter your name and press <Enter>:\n" );
gets ( buffer );
printf( "\nYour name has %d characters and spaces!",
strlen( buffer ) );
}本回答被提问者采纳
第2个回答 2015-12-06
最后两行最后漏了两个分号追问
不行诶
追答#include
#include
int main (void)
{
char buffer[256];
printf( "Enter your name and press :\n" );
gets ( buffer );
printf( "\nYour name has %d characters and spaces!",
strlen( buffer ) );
return 0;
}