C语言fw
发布时间: 2023-12-26 14:41:15
① C语言编程实现
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#defineinput"input.txt"
#defineoutput"output.txt"
#defineMax20
typedefstruct_Word_{
charwd[Max];
intn;
}sword;
intmain(intargc,char*argv[])
{
FILE*fr,*fw;
if((fr=fopen(input,"r"))==NULL)
printf("openerror");
charword[Max];
charc;
inti=0,j=0,num=0,flag=0;
sword*list=malloc(sizeof(sword));
do{
c=fgetc(fr);
if(c!=' '&&c!=' '&&c!=''&&c!=','&&c!='.'&&c!=EOF){
word[i++]=c;
flag=0;
}
else{
if(0==flag){
flag=1;
word[i]='