提交 bdf3dfb7 创建 作者: 宋海霞's avatar 宋海霞

modify

上级 7bb89885
...@@ -7,7 +7,7 @@ int main(int argc, char* argv[]) ...@@ -7,7 +7,7 @@ int main(int argc, char* argv[])
SeqString Target; SeqString Target;
// //
// 初始化源字符串 // Initializes the source string
// //
Source.data[0] = 'P'; Source.data[0] = 'P';
Source.data[1] = 'R'; Source.data[1] = 'R';
...@@ -23,7 +23,7 @@ int main(int argc, char* argv[]) ...@@ -23,7 +23,7 @@ int main(int argc, char* argv[])
Source.nLength = 10; Source.nLength = 10;
// //
// 初始化目标字符串 // Initializes the target string
// //
Target.data[0] = 'G'; Target.data[0] = 'G';
Target.data[1] = 'R'; Target.data[1] = 'R';
...@@ -32,33 +32,33 @@ int main(int argc, char* argv[]) ...@@ -32,33 +32,33 @@ int main(int argc, char* argv[])
Target.nLength = 3; Target.nLength = 3;
// //
// 将目标字符串插入到源字符串中 // Inserts the destination string into the source string
// //
InsertBefore(&Source, 4, &Target); InsertBefore(&Source, 4, &Target);
InsertBefore(&Source, 15, &Target); // 插入失败。插入位置非法。 InsertBefore(&Source, 15, &Target); // Failed to insert. The insertion position is invalid.
return 0; return 0;
} }
/* /*
功能: function:
在源字符串的第 i 个字符之前插入目标字符串。 Before the source string of the characters i inserted into the target string.
参数: parameter:
pSource -- 源字符串 pSource -- the source string
pos -- 插入位置。从 1 开始计数。 pos -- insertion position.Count from 1.
pTarget -- 目标字符串 pTarget -- the target string
返回值: returned value:
如果插入成功返回插入位置。 Returns the insertion position if successful.
如果插入失败返回 0 Returns 0 if insert fails
*/ */
int InsertBefore(SeqString* pSource, int pos, SeqString* pTarget) int InsertBefore(SeqString* pSource, int pos, SeqString* pTarget)
{ {
int nSourceIndex, nTargetIndex; // 字符串中的游标。作为数组下标,从 0 开始计数。 int nSourceIndex, nTargetIndex; // Cursor in string. Counts from 0 as array index.
// //
// TODO: 在此添加代码 // TODO: Add the code here
// //
return 0; return 0;
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论