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

modify

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