题目内容 (请给出正确答案)
[主观题]

有以下程序段:chara[]="English";char*p=a;intn=0;while(*p!=*^/0'){n++;p++}

有以下程序段:chara[]="English";

char*p=a;intn=0;

while(*p!=*^/0'){n++;p++}

结果中,n的值是()。

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“有以下程序段:chara[]="English";char*…”相关的问题

第1题

函数Rdata()实现从文件IN.dat中读取一篇英文文章存入字符串数组string中,请编写函数SortCharA(),其功能是:以行为单位对字符按从小到大的顺序进行排序,排序后的结果仍按行重新存入字爷串数组string中。最后调用函数Wdata(),把结果string输出到OUT.dat文件中。

例如,原文:dAe, BfC.

CcbbAA

结果:,. ABCdef

AACbbc

原始数据文件存放的格式是:每行的宽度均小于80个字符(含标点符号和空格)。

注意:部分源程序已经给出。请勿改动主函数main()、读数据函数Rdata()和输出数据函数Wdata()的内容。

include <stdio.h>

include <string.h>

include <conio.h>

char string [50] [80];

int maxline = 0; /* 文章的总行数 */

int Rdata (void);

void Wdata (void);

void SortCharA(void)

{

}

void main ()

{ if (Rdata ())

{ printf("数据文件 IN. dat 不能打开! \n\007");

return;

}

SortCharA ();

Wdata ( );

}

int Rdata (void)

{ FILE *fp;

int i = 0;

char *p;

if ((fp = fopen("IN. dat", "r")) == NULL)

return 1;

while (fgets(string[i], 80, fp) != NULL)

{ p = strchr(string[i], '\n');

if (p)

*p = 0;

i++;

}

maxline = i;

fclose (fp);

return 0;

}

void Wdata (void)

{ FILE *fp;

int i;

fp = fopen("OUT. dat", "w");

for (i=0; i<maxline; i++)

{ printf("%s\n", string[i]);

fprintf(fp, "%s\n", string[i]);

}

fclose (fp);

}

点击查看答案

第2题

函数ReadDat()的功能是实现从文件IN88.DAT中读取一篇英文文章存入到字符串数组xx中。请编制函数SortCharA(),该函数的功能是:以行为单位对字符按从小到大的顺序进行排序,排序后的结果仍按行重新存入字符串数组xx中。最后调用函数WriteDat()把结果xx输出到文件OUT88.DAT中。

例如,原文:dAe,BfC

CCbbAA

结果:ABCdef

AACCbb

原始数据文件存放的格式是:每行的宽度均小于80个字符,含标点符号和空格。

注意:部分源程序已给出。

请勿改动主函数main()、读函数ReadDat()和写函数WriteDat()的内容。

试题程序:

include<stdio.h>

include<string.h>

include<conio.h>

char xx[50] [80];

int maxline=0;

int ReadDat(void);

void WriteDat(void);

void SortCharA ( )

{

}

void main()

{

clrscr();

if (ReadDat())

{

printf ("数据文件IN88.DAT不能打开! \n\007");

return;

}

SortCharA();

WriteDat();

}

int ReadDat(void)

{

FILE *fp;

int i=0;

char *p;

if((fp=fopen("IN88.DAT","r"))==NULL)

return 1;

while(fgets(xx[i],80,fp) !=NULL)

{

p=strchr(xx[i],'\n');

if (p) *p=0;

i++;

}

maxline=i;

fclose(fp);

return 0;

}

void WriteDat()

{

FILE *fp;

int i;

clrscr();

fp=fopen("OUT88.DAT","w");

for(i=0;i {

printf("%s\n",xx[i]);

fprintf(fp,"%s\n",xx[i]);

}

fclose(fp);

}

点击查看答案

第3题

Foreigners can practice speaking English with people in the street.

A.Right

B.Wrong

C.Doesn't say

点击查看答案

第4题

Foreigners can practice speaking English with people in the street.

A.Right.

B.Wrong.

C.Doesn't say.

点击查看答案

第5题

Sue: Hi! Aren't we in the same English class?

Bill: ______

A、Yes,we are.My name's Sherry Clinton.

B、How are you doing?

C、Thank you very much.

D、It's so wonderful to meet you.

点击查看答案

第6题

数组a经初始化chara[]=“English”;a[7]中存放的是()。
A."h"

B.字符串的结束符

C.变量h

D.字符h

点击查看答案

第7题

Where can visitors find the best English food?

A.In London.

B.In the countryside.

C.In good restaurants.

D.At English homes.

点击查看答案

第8题

Where can visitors find the best English food?

A.In London.

B.In the countryside.

C.In good restaurants.

D.At English homes.

点击查看答案
热门考试 全部 >
相关试卷 全部 >
账号:
你好,尊敬的上学吧用户
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
谢谢您的反馈

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

警告:系统检测到您的账号存在安全风险

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

微信搜一搜
上学吧
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反上学吧购买须知被冻结。您可在“上学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
上学吧
点击打开微信