项目 3 - 顺序串算法(1)

来源:互联网 发布:淘宝二手iphone店铺 编辑:程序博客网 时间:2024/06/14 12:23
/*    *Copyright (c) 2016,烟台大学计算机学院 *All right reserved.    *文件名称:test.cpp    *作者:杨天瑞    *完成日期:2016年10月20日    *版本号:v1.3.2   *    *  问题描述:采用顺序储存方式储存串,并实现一些测试。   *程序输入:无。    *程序输出:顺序串的基本运算。    */ 
#include "sqstring.h"void Trans(SqString &s, char c1, char c2){    int i;    for (i=0; i<s.length; i++)        if (s.data[i]==c1)            s.data[i]=c2;}int main(){    SqString s;    StrAssign(s, "messages");    Trans(s, 'e', 'a');    DispStr(s);    return 0;}


1 0
原创粉丝点击