Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
Lab008
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
DS Lab Group
实验项目模板
Lab008
提交
bdf3dfb7
提交
bdf3dfb7
5月 20, 2019
创建
作者:
宋海霞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify
上级
7bb89885
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
15 行增加
和
15 行删除
+15
-15
main.c
main.c
+15
-15
没有找到文件。
main.c
浏览文件 @
bdf3dfb7
...
...
@@ -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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论