*all right reserved.
*檔名稱:逆序.cpp
*完成日期;2023年10月20日
*版本號;v1.0
* *問題描述: 試編寫演算法,實現將已知字串所有字元倒過來重新排列。如abcdef改為fedcba。
*輸入描述:字串
*程式輸出:逆序後的字串
*/
#include
#include "sqstring.h"
intmain()
#include
#include
#include "sqstring.h"
void
strassign(sqstring &s,
char
cstr)
//s為引用型引數
void
strcopy(sqstring &s,sqstring t)
//s為引用型引數
bool
strequal(sqstring s,sqstring t)
return
same;
} int
strlength(sqstring s)
sqstring concat(sqstring s,sqstring t)
sqstring substr(sqstring s,int
i,int
j)
sqstring insstr(sqstring s1,int
i,sqstring s2)
void
invert(sqstring &s)
} sqstring delstr(sqstring s,int
i,int
j)
sqstring repstr(sqstring s,int
i,int
j,sqstring t)
void
dispstr(sqstring s)
} #define maxsize 100 //最多的字元個數
typedef
struct
sqstring;
void
strassign(sqstring &s,
char
cstr);
//字串常量cstr賦給串s
void
strcopy(sqstring &s,sqstring t);
//串t複製給串s
bool
strequal(sqstring s,sqstring t);
//判串相等
intstrlength(sqstring s);
//求串長
sqstring concat(sqstring s,sqstring t); //串連線
sqstring substr(sqstring s,int
i,int
j);
//求子串
sqstring insstr(sqstring s1,int
i,sqstring s2);
//串插入
sqstring delstr(sqstring s,int
i,int
j) ;
//串刪去
sqstring repstr(sqstring s,int
i,int
j,sqstring t);
//串替換
void
dispstr(sqstring s);
//輸出串
void
invert(sqstring &s);
執行結果:
第八周 專案2
程式的版權和版本宣告部分 檔名稱 object.cpp 完成日期 2013年 4 月 23日 版本號 v1.0 輸入描述 無 問題描述 程式輸出 略。include using namespace std class ctime void settime int h,int m,int s void...
第八周專案2
標頭檔案 ifndef listring h included define listring h included typedef struct snode listring void strassign listring s,char cstr 字串常量cstr賦給串s void strcopy...
第八周專案2
include include lianchuan.h using namespace std intmain lianchuan.h cpp view plain copy ifndef lianchuan h included define lianchuan h included typede...