求大佬指点,C语言

#include<string.h>#include<stdio.h>intspace,other;voidfun(charstr[]){/***********begi... #include <string.h>
#include <stdio.h>
int space,other;
void fun(char str[])
{

/***********begin***********/
int i;
for(i=0;i<80;i++)
{
if(str[i]=' ')
space++;
else
other++;

}
return(space);
return(other);

/***********end************/

}

int main()
{
void NONO( ); //函数声明
char str[80];
printf("Input string:\n");
gets(str);
fun(str);
printf("空格:%d,非空格:%d\n",space,other);
NONO();
return 0;
}

void NONO( )
{ FILE *fr,*fw;
int i;
char s[80];
fr=fopen("E:\\exam\\999999\\PROGIN1.DAT","r");
fw=fopen("E:\\exam\\999999\\PROGOUT1.DAT","w");
space=other=0;
for(i=1;i<=5;i++)
{ fgets(s,80,fr);
space=other=0;
fun(s);
fprintf(fw,"空格:%d,非空格:%d\n",space,other);
} fclose(fr);
fclose(fw);
}
展开
 我来答
听不清啊
高粉答主

2018-12-24 · 说的都是干货,快来关注
知道顶级答主
回答量:7.8万
采纳率:89%
帮助的人:1.8亿
展开全部

#include <string.h>
#include <stdio.h>
int space,other;
void fun(char str[])
{

/***********begin***********/
int i;
for(i=0;str[i];i++)
{
if(str[i]==' ')
space++;
else
other++;

}

/***********end************/

}

int main()
{
void NONO( ); //函数声明
char str[80];
printf("Input string:\n");
gets(str);
fun(str);
printf("空格:%d,非空格:%d\n",space,other);
NONO();
return 0;
}

void NONO( )
{ FILE *fr,*fw;
int i;
char s[80];
fr=fopen("E:\\exam\\999999\\PROGIN1.DAT","r");
fw=fopen("E:\\exam\\999999\\PROGOUT1.DAT","w");
space=other=0;
for(i=1;i<=5;i++)
{ fgets(s,80,fr);
space=other=0;
fun(s);
fprintf(fw,"空格:%d,非空格:%d\n",space,other);
} fclose(fr);
fclose(fw);
}
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式