⇤ ← 于2006-03-12 15:45:24修订的的版本1
483
备注:
|
1015
|
删除的内容标记成这样。 | 加入的内容标记成这样。 |
行号 7: | 行号 7: |
= 实验1 = | = 实验2-1 = |
行号 20: | 行号 20: |
= 实验2-2 = * strcrop(s, i, j) 取字符串s中第i个到第j个字符 * strdel(s, i, j) 将字符串s中第i个到第j个字符删除 for example: {{{#!cplusplus char s[20]="hello world"; char t[20]="hello world"; strcrop(s, 1, 8); strdel(t, 1, 8); printf("%s\n%s\n", s, t); }}} output: {{{ ello wor hld }}} = 实验2-3 = 写一个函数weekday(y,m,d),求取y年m月d日是星期几,返回星期几的名字。例如: {{{#!cplusplus printf("%s", weekday(2006,3,6)); }}}输出 {{{Monday }}} |
实验要求
- 实验前对实验内容做好预习
- 有效利用实验时间,不做与实验无关的活动
- 独立完成实验内容
- 按时提交实验报告
实验2-1
1. 实验内容
写一个函数strinsert(s, n, t)在字符串s的第n个字符后面插入字符串t。比如:
输出: {{{write once, run everywhere }}}
实验2-2
- strcrop(s, i, j) 取字符串s中第i个到第j个字符
- strdel(s, i, j) 将字符串s中第i个到第j个字符删除
for example:
output:
ello wor hld
实验2-3
写一个函数weekday(y,m,d),求取y年m月d日是星期几,返回星期几的名字。例如:
1 printf("%s", weekday(2006,3,6));
输出