目录
1、创建SqString.cpp文件
#include <stdio.h>
#include "string.h"
//定义顺序串
#define MaxSize 100
typedef struct
{
// 存放串字符
char data[MaxSize];
//存放串的实际长度
int length;
}SqString;
//串赋值运算
void Assign(SqString &s,char str[])
{
int i=0;
//遍历str的所有字符
while(str[i]!='\0')
{
s.data[i]=str[i];
i++;
}
s.length=i;
}
//输出串运算
void DipStr(SqString s)
{
int i;
for(i=0;i<s.length;i++)
printf("%c",s.data[i]);
printf("\n");
}