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

写出下列程序的运行结果。#includevoid Fun(){int num=20;cout<<"The Fun's num

写出下列程序的运行结果。#includevoid Fun(){int num=20;cout<<"The Fun's num

写出下列程序的运行结果。

#include

void Fun()

{

int num=20;

cout<<"the fun's num is"<

}

void main()

{

int num=10;

cout<<"the main's num is "<

Fun();

{

int num=30;

cout<<"the field's num is "<

}

cout<<"the main's num is "<

}

查看答案
更多“写出下列程序的运行结果。#includevoid Fun(){int num=20;cout<<"The Fun's num”相关的问题

第1题

已知考生的记录由学号和学习成绩构成,N名考生的数据已存入a结构体数组中。请编写函数fun,该函数的功能是:找出成绩最低的考生记录,通过形参返回主函数(规定只有一个最低分)。已给予出函数的首部,请完成该函数。

注意:部分源程序已存在文件test8_2.cpp中。

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

文件test8_2.cpp的内容如下:

include<iostream.h>

include<string.h>

include<conio.h>

define N 10

typedef struct ss

{char num[10];

int s;

} STU;

void fun(STU a[],STU *s)

{

}

void main( )

{STU

a[N]={{"A01”,81},{"A02",89},{"A03",66},{"A04",87},{"A05",77},{"A06",90},{"A07",79}, {"A08",61},{"A09",80},{"A10",71}},m;

fun(a,&m);

cout<<"***** The original date *****"<<endl;

cout<<"The lowest :"<<m.num<<m.s<<endl;

}

点击查看答案

第2题

下列程序运行结果是 。 class Student { int score ; s...

下列程序运行结果是 。 class Student { int score ; static int count ; public : Student ( int n=0) { score =n ; count++ ; } Student (Student &p) { score =p. score ; count++ ;} ~Student ( ) { cout<<"the number of the students: endl; } void showscore( )> < <endl; } static int getcount( ){ return count="0" ; student fun(student p0) { p1="p0;" number of the students: endl p1; :: void main( ) john(80) cout "the score john: "; john.showscore( ); tom; tom="fun(John);" tom: tom.showscore(>

点击查看答案

第3题

请编写一个函数void fun(cbara [], charb [], int n),其功能是:删除一个字符申中指定下标的字符。其中,a指向原字符串,删除后的字符串存放在b所指的数组中,n中存放指定的下标。

例如,输入一个字符串world,然后输入3,则调用该函数后的结果为word。

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

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

试题程序:

include <stdio.h>

include <conio.h>

define LEN 20

void fun (char a[], char b [], int n)

{

}

main ()

{

char str1 [LEN], str2 [LEN];

int n ;

clrscr ();

printf ("Enter the string : \n") ;

gets (str1) ;

printf ("Enter the position of the string

deleted: ");

scanf ("%d", &n) ;

fun (str1, str2, n) ;

printf ("The new string is : %s \n",

str2) ;

}

点击查看答案

第4题

请编写一个函数int fun (int nFirst, int nSecond),求两个数的最小公倍数并返回这个值。

注意:部分源程序已存在文件test13_2.cpp中。如输入7和8时,结果是56。

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

文件test13_2的内容如下;

include<iostream.h>

int fun(int nFirst,int nSecond);

void main()

{

int nFirst,nSecond;

cout<<"Please input the first one";

cin>>nFirst;

cout<<" Please input the second one";

cin>>nSecond;

cout<<"最小公倍数:"<<fun(nFirst,nSecond)<<endl;

}

int fun(int nFirst,int nSecond)

{

}

点击查看答案

第5题

请读程序: # include<stdio.h> Char fun(char*c) (if(c<='z'& & * c>='A') * c-='A'-'a' return * c; } main() { char s[81],* p=s; gets(s); while(* p) { * p=fun(p);putchar(* p);p + +; puchar('\n'); } 若运行时从键盘上输入OPEN THE DOOR <CR>(<CR>表示回车),则上面程序的输出结果是 ( )

A.oPEN tHE dOOR

B.ope the door

C.OPEN THE DOOR

D.Open The Door

点击查看答案

第6题

下列给定程序中,函数fun()的功能是逐个比较a,b两个字符串对应位置中的字符,把ASCII值小或相等的字符依次存放到c数组中,形成一个新的字符串。

例如:a中的字符串为fshADfg,b中的字符串为sdAEdi,则c中的字符串应为fdAADf。

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

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

试题程序:

include <stdio.h>

include <strinq.h>

void fun(char *p,char *q,char *c)

{int k=0;

while(*p || *q)

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

{ if (*p<=*q)

c[k]=*q;

else c[k]:*p;

if(*p) p++;

if(*q)q++;

/**+**********found**************/

k++

}

}

main()

{char a[10]="fshADfg",b[10]="sdAEdi",

c[80]={'\0');

fun(a,b,c);

printf("The string a:");puts(a);

printf("The string b:");puts(b);

printf("The result:");puts(c);

}

点击查看答案

第7题

使用VC6打开考生文件夹下的工程RevPrroj7。此工程包含一个源程序文件 RevMain7.cpp。在该文件中,函数fun()的功能是:逐个比较a、b两个字符串对应位置中的字符,把ASCII码值大或相等的字符依次存放到c数组中,形成一个新的字符串。例如:若a中的字符串为aBCDeFgH,b中的字符串为ABcd,则c中的字符串为 aBcdeFgH。

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

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

源程序文件RevMain7.cpp中的程序清单如下:

//RevMain7.cpp

include<iostream>

include<string>

using namespace std;

void fun(char *p,char *q,char *c)

{

int k=1;

while(*p!=*q)

{

if(*p<*q)

c[k]=*q;

else

c[k]=*p;

if(*p)

p++;

if(*q)

q++;

}

}

int main()

{

char a[10]="aBCDeFgH",b[10]="ABcd",c[80]={'\0'};

fun(a,b,c);

cout<<"The string a is "<<a<<'\n';

cout<<"The string b is "<<b<<'\n';

cout<<"The string c is "<<c<<endl;

return 0;

}

点击查看答案

第8题

某学生的记录由学号、8门课成绩和平均分组成,学号和 8门课的成绩已在主函数中给出。请编写fun()函数,它的功能是:求出该学生的平均分放在记录的ave成员中。请自己定义正确的形参。

例如,若学生的成绩是85.5,76,69.5,85,91,72,64.5, 87.5,则他的平均分应当是78.875。

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

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

试题程序:

include<stdio.h>

define N 8

typedef struct

{ char num [10];

double s[N];

double ave;

} STREC;

void fun()

{

}

main()

{

STREC s={"GA005",85.5,76,69.5,85,91, 72,64.5,87.5);

int i;

fun (&s);

printf("The %s' s student data:\n",s.num)/ /*输出学号*/

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

printf("%4.1f\n", s.s[i]);

/*输出各科成绩*/

printf("\nave=%7.3f\n",s.ave);

/*输出平均分*/

}

点击查看答案

第9题

学生的记录由学号和成绩组成,N名学生的数据已存放在主函数的结构体数组s中,请编写函数fun,它的功能是:把低于平均分的学生数据放在b所指的数组中,低于平均分的学生人数通过形参n传回,平均分通过函数值返回。

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

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

[试题源程序]

include<stdio.h>

define N 8

typedef struct

{

char num[10];

double s;

}STREC;

double fun(STREC *a, STREC *b, int *n)

{

}

void main()

{

STREC s[N]={{"GA05", 85},

{"GA03", 76}, {"GA02", 69}, {"GA04", 85},

{"GA01", 91}, {"GA07", 72}, {"GA08", 64},

{"GA06", 87}};

STREC h[N], t; FILE *out;

int i, j, n;

double ave;

ave=fun(s, h, &n);

printf("The %d student data which is lower than %7.3 f:\n", n, ave);

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

printf("%s %4.1f\n", h[i]. num, h[i].s);

printf("\n");

ut=fopen("out.dat", "W");

fprintf(out, "%d\n%7.3f\n", n, ave);

for(i=0; 2<n-1; i++)

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

if(h[i]. s>h[j].s)

{

t=h[i];

h[i]=h[j];

h[j]=t;

}

for(i=0; 2<n; i++)

fprintf(out, "%4.1f\n", h[i].s);

fclose(out);

}

点击查看答案

第10题

请补充函数fun(),该函数的功能是建立一个带头结点的单向链表并输出到文件“out98.dat”和屏幕上,各结点的值为对应的下标,链表的结点数及输出的文件名作为参数传入。

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

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

试题程序:

include<stdio. h>

include<conio. h>

include<stdlib. h>

typedef struct ss

{

int data;

struct ss *next;

} NODE;

void fun(int n,char*filename)

{

NODE *h,*p, *s;

FILE *pf;

int i;

h=p= (NODE *) malloc (sizeof (NODE));

h->data=0;

for (i=1; i {

s=(NODE *)malloc (sizeof (NODE));

s->data=【 】;

【 】;

p=【 】

}

p->next=NULL;

if ( (pf=fopen (filename, "w") ) ==NULL)

{

printf {"Can not open out9B.clat! ");

exit (0);

}

p=h;

fprintf (pf, "\n***THE LIST***\n");

print f ("\n***THE LIST***\n")

while (p)

{

fprintf (pf, "%3d", p->data)

printf ("%3d",p->data);

if (p->next ! =NULL)

{

fprintf (pf, "->");

printf ("->");

}

p=p->next;

}

fprintf (pf, "\n");

printf ("\n");

fclose (pf);

p=h;

while (p)

{

s=p;

p=p->next;

free (s);

}

}

main()

{

char * filename="out98. dat";

int n;

clrscr ();

printf (" \nInput n: ");

scanf ("%d", &n);

fun (n, filename);

}

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

1. 搜题次数扣减规则:

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

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

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

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

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

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

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

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

上学吧找答案