题目
以下程序输出结果为______。
include<iostream>
using namespace std;
class TestClass 1
{
public:
TestClass1(){}
TestClass1(int i)
{x1=i;}
void dispa()
{cout<<"x1="<<x1<<",";}
private:
int x1;
}:
class TestClass2:public TestClass1
{
public:
TestClass2(){}
TestClass2(int i):TestClass1(i+10)
{
x2=i:
}
void dispb()
{
dispa();
cout<<"x2="<<x2<<end1;
}
private:
int x2:
}:
int main()
{
TestClass2 b(2):
b.dispb();
return 0;
}
第1题
A.666
B.667
C.输出内容不定
D.程序错误,无法运行
第2题
以下程序运行后的输出结果是 。
inc]udc
main()
{int x=10.y=20.t=0;
if(x==y) t=x;x=y;y=1;
printf(“%d %d/n”.x,y);
第3题
A.666
B.667
C.输出内容不定
D.程序错误,无法运行
第4题
(14)以下程序运行后的输出结果是 【14】 。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main()
{ char *p; int i;
p=(char *)malloc(sizeof(char)*20);
strcpy(p,"welcome");
for(i=6;i>=0;i--) putchar(*(p+i));
printf("\n "); free(p);
}
第5题
A.方波
B.三角波
C.锯齿波
D.梯形波
第6题
A.方波
B.三角波
C.锯齿波
D.梯形波
第7题
A.方波
B.三角波
C.锯齿波
D.梯形波
第8题
A.方波
B.三角波
C.锯齿波
D.梯形波
第9题
请补充函数fun(),该函数的功能是:把ASCⅡ码为偶数的字符从字符串s打中删除,结果仍然保存在字符串srt中,字符串str从键盘输入,其长度作为参数传入函数fun()。
例如,输入“abcdef”,输出“ace”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。
试题程序:
inc lude< stdio, h>
define N 80
【 】
{
int i, j;
【 】
for (i=0;i<n;i++)
{
if (s [i] %2!=0)
s [j++]=s [i];
}
【 】;
}
main ()
{
int i=0, strlen=0;
char str[N];
clrscr ();
printf ("\nInput a string:\n");
gets (str);
while (str [i] !=' \0' )
{
strlen++;
i++;
}
fun (str, strlen);
printf("\n*** display string ***\n");
puts (str);
}
为了保护您的账号安全,请在“赏学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!