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

下面程序的运行结果是()。include<stdio.h> define SlZE 12 main() {char s[SIZE];int i;for(i=0

下面程序的运行结果是()。

include<stdio.h>

define SlZE 12

main()

{char s[SIZE];int i;

for(i=0;i<SIZE;i++) s[i]='A'+i+32;

sub(s,5,SIZE-1);

for(i=0;i<SIZE;i++)printf("%c",s[i]);

printf("\n");}

sub(char *a,int t1,int t2)

{ char ch;

while(t1<t2)

{ ch=*(a+t1);

*(a+t1)=*(a+t2);

*(a+t2)=ch;

t1++;t2--;

}

}

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“下面程序的运行结果是()。include<stdio.h> …”相关的问题

第1题

下列程序的功能:对输入的一行字符中的数字字符的字面值累加,输出此累加和,请填空。include<stdio.

下列程序的功能:对输入的一行字符中的数字字符的字面值累加,输出此累加和,请填空。

include<stdio.h>

include<ctype.h>

main()

{ char c;

int a,s=0;

while(______)

if(isdigit(c))

{a=c-'0';s+=a;}

printf("s=%d",s);

}

点击查看答案

第2题

请编写函数fun(),该函数的功能是:将s所指字符串中 ASCII值为偶数的字符删除,串中剩余字符形成一

个新串放在t所指的数组中。

例如,若s所指字符串中的内容为ABCDEFGl2345,其中字符B的ASCⅡ码值为偶数、…、字符2的ASCⅡ码值为偶数、…,都应当删除,其他依次类推。最后t所指的数组中的内容应是ACEGl35。

注定:部分源程序给出如下。

请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。

试题程序;

include <stdio. h>

include<string.h>

include<conio. h>

void fun(char *s, char t[])

{

}

main ( )

{

char s[100],t [100];

clrscr ();

printf (,\nPlease enter string S: ");

scanf ("%s", s);

fun(s,t);

printf ("\nThe result is :%s\n",t);

}

点击查看答案

第3题

下列给定的程序中,函数fun()的功能是:用选择法对数组中的n个元素按从大到小的顺序进行排序。请改

正程序中的错误,使它能得到正确结果。

注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。

试题程序:

include<stdio.h>

define N 20

void fun(int a[ ],int n)

{

int i,j,t,p;

/*************found*************/

for(j=0;j<n-1;j++) ;

{

p=j;

for(i=j;i<n;i++)

if(a[i)>a[p])

p=i;

t=a[p];

a[p]=a[i];

/*************found**************/

a[p]=t;

}

}

main()

{

int a[N]={11,32,-5,2,14},i,m=5;

printf(“排序前的数据:”);

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

printf(“%d”,a[i]);

printf(“\n”);

fun(a,m);

printf(“排序后的顺序:”);

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

printf(“%d”,a[i]);

printf(“\n”);

}

点击查看答案

第4题

以下程序的输出结果是( )。 include<stdio.h>fun(){ int a=0;a+=3;printf("%d",A); } main() {int

以下程序的输出结果是( )。

include<stdio.h>

fun()

{ int a=0;

a+=3;

printf("%d",A);

}

main()

{ int cc;

for(cc=1;cc<=4;cc++)

fun();

printf("\n");

}

点击查看答案

第5题

下面程序的功能是:从输入的正整数中选3个数进行输出,要求这些数都是2的倍数,请填空。 main() { in

下面程序的功能是:从输入的正整数中选3个数进行输出,要求这些数都是2的倍数,请填空。

main()

{ int a,i=0;

scanf("%d",&A);

do

{ if(a>0&&a%2==0)

{printf("%d\n",A);i++;}

if(i!=3)

{ scanf("%d",&A);}

}while(( ));

}

点击查看答案

第6题

以下程序打开新文件f.txt,并调用字符输出函数将a数组中的字符写入其中,请填空。include<stdio.

以下程序打开新文件f.txt,并调用字符输出函数将a数组中的字符写入其中,请填空。

include<stdio.h>

main( )

{________*fp;

char a[5]=(’1’,’2’,’3’,’4’,’5’),i;

fp=fopen(”f.txt”,”w”);

for(i=0;i<5;i++)fputc(a[i],fp);

fclose(fp);

}

点击查看答案

第7题

下列给定程序中,函数fun()的功能是:在字符串的最前端加入n个*号,形成新串,并且覆盖原串。 注意:字

下列给定程序中,函数fun()的功能是:在字符串的最前端加入n个*号,形成新串,并且覆盖原串。

注意:字符串的长度最长允许79。

请改正函数fun()中的错误,使它能得出正确的结果。

注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。

试题程序;

include <stdio.h>

include <strzng.h>

include <conio.h>

/*****************found***************/

void fun(char s[], int n)

{

char a[80],*p;

int i;

/*****************found***************/

s=p;

for(i=0; i<n; i++) a[i]='*';

do

{a[i]=*p;

/*****************found***************/

i++;

}while(*p);

a[i]=0;

strcpy(s,a);

}

main()

{ int n;char s[80];

clrscr();

printf("\nEnter a string:");gets(s);

printf("\nThe string\%s\n",s);

printf("\nEnter n(number of*):");scanf ("%d",&n);

fun(s,n);

printf("\nThe string after inster: \%s\n",s);

}

点击查看答案

第8题

请补充main函数,该函数的功能是:从字符串str中取出所有数字字符,并分别计数,然后把结果保存在数

组b中并输出,把其他字符保存在N[10]中。

例如:当str1=“ab123456789cde090”时,结果为:

0: 2 1: 1 2: 1 3: 1 4: 1 5: 1 6: 1 7: 1 8: 1 9:2 other charactor:5

注意:部分源程序给出如下。

请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。

试题程序:

include <stdio.h>

include <conio.h>

main()

{

int i,b[11];

char *str="abl23456789cde090";

char *p=str;

clrscr();

printf("***the origial data ***\n");

puts(str);

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

b[i]=0;

while(*p)

{

switch(【 】)

{

case '0':b[0]++;break;

case '1':b[1]++;break;

case '2':b[2]++;break;

case '3':b[3]++;break;

case '4':b[4]++;break;

case '5':b[5]++;break;

case '6':b[6]++;break;

case '7':b[7]++;break;

case '8':b[8]++;break;

case '9':b[9]++;break;

【 】

}

【 】

}

printf("****** the result ********\n");

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

printf("\n%d:%d",i,b[i]);

printf("\nother charactor:%d",b[i]);

}

点击查看答案

第9题

请编写函数fun(),该函数的功能是:将M行N列的二维数组中的字符数据,按列的顺序依次放到一个字符串

中。

例如,若二维数组中的数据为:

W WWW

S S S S

H H H H

则字符串中的内容应是WSHWSHWSHWSH。

注意:部分源程序给出如下。

请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。

试题程序:

include<stdio.h>

define M 3

define N 4

void fun(char (*s)[N],char *b)

{

}

main()

{

char a[100],w[M][N]={{ 'W', 'W', 'W', 'W'},

{'S', 'S', 'S', 'S'},{'H', 'H', 'H', 'H'}};

int i,j;

printf("The matrix:\n");

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

{ for(j=0;j<N;j++)

printf("%3c",w[i][j]);

printf("\n");

}

fun(w,a);

printf("The A string:In");

puts(a);

printf("\n\n");

}

点击查看答案

第10题

以下程序运行后的输出结果是【】。 main() {intp[7]={11,13,14,15,16,17,18}; inti=0,j=0;while(i<7

以下程序运行后的输出结果是【 】。

main()

{ int p[7]={11,13,14,15,16,17,18};

int i=0,j=0;

while(i<7&&p[i]%2==1)j+=p[i++];

printf("%d\n",j);

}

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

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

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

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

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