|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <stdio.h>
#include <ctype.h>
#define SIZE 80
void getword(char *str,int size);
int main(void)
{
char input[SIZE];
int num = 3;
printf("Please enter the MAX size:");
scanf_s("%d", &num);
printf("Please enter a string:");
gets(input);
getword(input,num);
puts(input);
getchar();
getchar();
return 0;
}
void getword(char *str,int size)
{
char *ch;
ch = str;
while (!isspace(*ch++));
if ((ch - str) > size)
str[size] = '\0';
else
str[ch - str] = '\0';
}
求救一下哪里出错,以编译就不行,在gets那里输入不了字符 |
|