皮皮学,免费搜题
登录
搜题
【简答题】
编写一个函数findStr(),该函数统计一个长度为2的子字符串在另一个字符串中出现的次数。例如,假定输入的字符串为'asd asasdfg asd as zx67 asd mklo',子字符串为'as',函数返回值是6。 函数ReadWrite()实现从文件in.dat中读取两个字符串并调用函数findStr(),最后把结果输出到文件out.dat中。 注意:部分程序已经给出。 请勿改动主函数main()和其他函数中的任何内容,仅在函数findStr()的花括号中填入你编写的若干语句。 include <stdio.h> include <string.h> include <conio.h> int findStr(char *str,char *substr) { } main() { char str[81],substr[3]; int n; clrscr(); printf('输入原字符串'); gets(str) ; printf('输入子字符串:'); gets(substr); puts(str); puts(substr); n=findStr(str, substr); printf('n=%d/n', n); ReadWrite(); } ReadWrite() { char str[81],substr[3],ch; int n, len,i=0; FILE *rf, *wf; rf=fopen('in.dat', 'r'); wf=fopen('out.dat', 'w'); while(i<25) { fgets(str, 80, rf); fgets(substr, 10, rf); len=strlen(substr)-1; ch=substr[len]; if(ch=='/n' || ch==0xla)substr[len]=0; n=findStr(str, substr); fprintf(wf, '%dkn', n); i++; } fclose(rf); fclose(wf); }
拍照语音搜题,微信中搜索"皮皮学"使用
参考答案:
参考解析:
知识点:
.
..
皮皮学刷刷变学霸
举一反三
【单选题】风华实业公司在组织结构上采用的是职能型,这种组织结构可能带了的最大缺陷是什么?
A.
多头指挥
B.
各部门之间难以协调。
C.
职权职责不清。
D.
高层管理者难以控制。
【单选题】下列最早完成全基因组测序的是
A.
噬菌体Φ -X174
B.
酵母菌
C.
人类
D.
人类线粒体
【判断题】防水型罩面对于二级及二级以下公路可采用乳化沥青混合料。
A.
正确
B.
错误
【简答题】I have two friends. names are Lucy and Lily. They are twins(双胞胎). They from the USA. Lucy and Lily look the same. have blue eyes and brown hair. They are thir old. But they are in different clothe...
【简答题】(一) Bill: Hi, Lucy. What chores do you have to do at home? Lucy: I have to sweep the floor, do the dishes and set the table. Bill: How often do you set the table? Lucy: Once a week. Bill: Hi, Lily. Wh...
【多选题】下列关于梅花的介绍正确的有( )?
A.
梅花是我国最早取得国际品种登录权的花卉
B.
梅花是我国唯一取得国际品种登录权的花卉
C.
我国已完成梅花全基因组测序和精细图构建
D.
梅花至今没有确切的英文名
E.
我国是世界梅花的起源与分布中心
【单选题】Lucy and I have the same mobile phones and I find it difficult to________ between them.
A.
disappear
B.
distinguish
C.
extinguish
D.
disagree
【单选题】[CrF 6 ] 3- 的杂化类型和空间构型为 ( )
A.
sp 3 d 2 八面体
B.
d 2 sp 3 八面体
C.
dsp 3 三角双锥
D.
sp 3 d 三角双锥
【单选题】Lucy and I have the same mobile phones and I find it difficult to distinguish ____ them.
A.
from
B.
between
C.
by
D.
off
【单选题】下列对新型隐球菌脑膜炎描述错误的是()
A.
是中枢神经系统最常见的真菌感染
B.
临床表现与结核性脑膜炎相似
C.
常见于有慢性消耗性疾病或全身性免疫缺陷性疾病的患者
D.
多急性起病,病情进展快
相关题目: