重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
找答案首页 > 全部分类 > 求职面试
搜题
网友您好, 请在下方输入框内输入要搜索的题目:
搜题
题目内容 (请给出正确答案)
[主观题]

已存在文件file.txt,其内容为sample1234ASDw,请写出程...

已存在文件file.txt,其内容为sample1234ASDw,请写出程序的运行结果 。 #include <stdio.h> #include <stdlib.h> int main() { FILE *fp; char ch; int count=0; fp = fopen("file.txt", "r" ); if (fp == 0 ) { printf("file error\n" ); exit(1); } ch = fgetc(fp); while(!feof(fp ) ) { if (ch >= 'a' && ch <= 'z') count++; ch="fgetc(fp);" } printf("%d\n", count); fclose(fp ); return 0;>

查看答案
更多“已存在文件file.txt,其内容为sample1234ASDw,请写出程...”相关的问题

第1题

语句QEw DB’AsDF’是合法的。( )

此题为判断题(对,错)。

点击查看答案

第2题

编写一个函数findStr(),该函数统计一个长度为2的字符串在另一个字符串中出现的次数。例如,假定输入的字符串为"asd asasdfg asd as zx67 asd mklo",子字符串为“as”,函数返回值是6。

函数ReadWrite()的功能是实现从文件in40.dat中读取两个字符串,并调用函数findstr(),最后把结果输出到文件out40.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=%dkn",n);

ReadWrite();

}

ReadWrite()

{

char ch, str[81],substr[3];

int n,len, i=0;

FILE *rf,*wf;

rf=fopen("in40.dat","r");

wf=fopen("out40.dat","w");

while(i<5)

{

fgets(str,80,rf);

fgets(substr,10,rf);

len=strlen(substr)-1;

ch=substr[len];

if(ch=='\n'||ch==Oxla)

substr[len]=0;

n=findStr(str,substr);

fprintf(wf,"%dln",n);

i++;

}

fclose(rf);

fclose(wf);

}

点击查看答案

第3题

听力原文:M: Hey! You got a new television.

W: Yeah! It was delivered yesterday. What do you drink of it?

M: It's huge. It practically takes up file entire side of the room.

W: I know. I know, you don't drink it's, well, excessive, do yen?

M: I didn't say that. I metal, if you enjoy it, why not? What happened to your old TV, anyway?

W: It just stopped working last Friday. It was pretty old and didn't work well. I thought you eon afford it. Why not get a new one?

M: It must have been expensive.

W: Well, not as much as you might think. I got it on sale for 50% off.

M: Really? Where?

W: At file stereo city on Route 20. You know at first I just wanted to replace what I had, a TV of about the same size and quality. But the salesman was pushing these because of the 50% off.

M: Yeah. But 50% off what?

W: 2,400 dollars.

M: You spent $ 1,200 on a TV?

W: It's got a lot of special features. Look at this remote control.

M: I'm sure. But that's still a lot of money for a television. I didn't think you watch TV that much.

W: Well, I don't. Do you think I ought to return it? If I do it within a week of purchase, I canget my money back.

M: Honestly, yes. And you know what, I think you ought to mad up on TVs first and choose the make and model you want before you go to the store. That way you will get what you want.

W: I think you are fight.

(20)

A.A popular television program.

B.A breakthrough in technology.

C.A recent purchase.

D.A new electronic store.

点击查看答案

第4题

编写一个函数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);

}

点击查看答案

第5题

行走式浏览,通过ASDW进行移动( )
点击查看答案

第6题

No sooner had we sat down we found it was time to go.

A.than

B.when

C.as

D.while

点击查看答案

第7题

用ls命令以长格式列目录信息时,若某一文件的特征在文件列表中按如下顺序显示在屏幕上: drwxrw-r--2usergk3564Oct2810:30/user/asd.h则同组人的访问权限是().

A.读和执行

B.读或执行

C.写和执行

D.读和写

点击查看答案

第8题

听力原文:M: Is that physics course as difficult as everyone says?

W: Worse, believe it or not.

What does the woman say about the course?

A.It is more difficult than everyone says.

B.It is not interesting at all.

C.She doesn't believe the course is difficult.

D.It is as difficult as everyone says.

点击查看答案

第9题

Which of the following would be considered downflooding on a fishing vessel as defined in regulation?

A.Vessel heels until water enters a hatch

B.Vessel in collision floods through a damaged area above the waterline

C.Vessel takes on water due to the hatches being left open in heavy rain

D.Vessel takes on water by the propeller shaft due to failure of the stern gland

点击查看答案

第10题

Since she was accustomed to having her own room, it was difficult for her to ______ a roommate.

A.put up from

B.put up by

C.put up with

D.put up to

点击查看答案
下载上学吧APP
客服
TOP
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案
购买前请仔细阅读《购买须知》
请选择支付方式
微信支付
支付宝支付
选择优惠券
优惠券
请选择
点击支付即表示你同意并接受《服务协议》《购买须知》
立即支付
搜题卡使用说明

1. 搜题次数扣减规则:

功能 扣减规则
基础费
(查看答案)
加收费
(AI功能)
文字搜题、查看答案 1/每题 0/每次
语音搜题、查看答案 1/每题 2/每次
单题拍照识别、查看答案 1/每题 2/每次
整页拍照识别、查看答案 1/每题 5/每次

备注:网站、APP、小程序均支持文字搜题、查看答案;语音搜题、单题拍照识别、整页拍照识别仅APP、小程序支持。

2. 使用语音搜索、拍照搜索等AI功能需安装APP(或打开微信小程序)。

3. 搜题卡过期将作废,不支持退款,请在有效期内使用完毕。

请使用微信扫码支付(元)
订单号:
遇到问题请联系在线客服
请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系在线客服
恭喜您,购买搜题卡成功 系统为您生成的账号密码如下:
重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁。
发送账号到微信 保存账号查看答案
怕账号密码记不住?建议关注微信公众号绑定微信,开通微信扫码登录功能
警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

- 微信扫码关注上学吧 -
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反上学吧购买须知被冻结。您可在“上学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
- 微信扫码关注上学吧 -
请用微信扫码测试
选择优惠券
确认选择
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,如果您知道正确答案,欢迎您来纠错

上学吧找答案