目录
1、创建LinkString.cpp文件
#include <stdio.h>
#include <malloc.h>
#define MaxSize 100
typedef struct node{
char data;
struct node *next;
}LinkString;
//串赋值运算
void Assign(LinkString *&s,char str[]){
int i=0;
LinkString *p,*tc;
s=(LinkString *)malloc(sizeof(LinkString));
tc=s;
while(str[i]!='\0'){
p=(LinkString *)malloc(sizeof(LinkString));
p->data=str[i];
tc->next=p;tc=p;
i++;
}
tc->next=NULL;
}
//输出串运算
void DispStr(LinkString *s){
LinkString *p=s->next;
while(p!=NULL){
printf("%c",p->data);
p=p->next;
}
printf("\n");
}
这篇博客主要介绍了如何创建并使用LinkString.cpp和ComeCount.cpp文件来统计一个字符串中不同字符的数量以及每个字符出现的次数。通过程序实现,详细展示了整个过程,包括文件创建和运行结果。
订阅专栏 解锁全文
222

被折叠的 条评论
为什么被折叠?



