题目
下面程序的运行结果为()。 #include <iostream> using namespace std; class A{ public: A(){cout<<" ";} ~A(){cout<<" ";} } class B:public A{ public: B(){cout<<" ";} ~B(){cout<<" ";} } void main(){ B b; }
A.1234
B.1324
C.1342
D.3142
第1题
有以下程序(strcpy为字符串复制函数,strcat为字符串连接函数): #include<stdio.h> #include<string.h> main() {char a[10]="abc",b[10]="012",c[10]="xyz"; strcpy(a+1,b+2); puts(strcat(a,c+1)); } 程序运行后的输出结果是()。
A.al2xyz
B.12yz
C.a2yz
D.bc2yz
第2题
第3题
下面程序的功能是:对字符串从小到大进行排序并输出,请填空。
#include "string.h"
#include "stdio.h"
sort(char *a[],int n)
{ int i,j;
char *p;
for(j=1;j<=n-1;j++)
for(i=0; 【15】 ;i++)
if(【16】 >0)
{ p=a[i];
a[i]=a[i+1];
a[i+1]=p;}}
main()
{ int i;
char *book[]={"itisme","itisyou","howareyou","fine","goodnight","goodbye"};
sort(【17】 );
for(i=0;i<6;i++)
printf("%s\n",book[i]);}
第4题
若有0~9之间不同的3个数构成一个三位数,下面程序将统计出共有多少种方法,请填空完成此程序。
include <iostream>
using namespace std;
int main ()
{
int i,j,k;
for(i = 1;i<=9;i++)
{
for (j=O; j<=9; j++)
{
if(【 】)
continue;
else
{
for(k = 0;k<=9;k++)
if(【 】)
count++;
}
}
}
cout<<count<<end1;
return 0;
}
第8题
第9题
下面程序的运行结果为 【10】 。
#include(iostream. h>
void fun(int x=0,int y=0)
{
cout<<
}
void main()
{
fun(5);
}
为了保护您的账号安全,请在“赏学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!