题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-01-28 18:21:14

[填空题]设有下列程序: #include<stdio.h> #include<string.h> main( ) { int i; char si 10],ti 10]; gets(t); for(i=0;i<2;i++) { gets(s); if(strcmp(t,s)<0)strcpy(t,s); } printf("%s/n",t); } 程序运行后,从键盘上输入(<CR>代表回车符):CDEF<CR>BADEF<CR>QTHRG<CR>,则程序的输出结果是______。

更多"设有下列程序: #include<stdio.h> "的相关试题:

[填空题]设有下列程序: #include<stdio.h> #include<string.h> main( ) { int i; char s[10],t[10]; gets(t); for(i=0;i<2;i++) { gets(s); if(strcmp(t,s)<0)strcpy(t,s); } print f("%s/n",t); } 程序运行后,从键盘上输入(<CR>代表回车符): DEF<CR>BADEF<CR>QTHRG<CR>,则程序的输出结果是______。
[单项选择]以下程序运行后的输出结果是
#include<stdio.h>
#include<string.h>
main( )
 char x[]="STRING";
 x[0]=0; x[1]='/0'; x[2]='0';
 printf("%d%d/n", sizeof(x),strlen(x));

A. 6 1 B) 7 0 C) 6 3 D) 7 1
[单项选择]下列程序的运行结果是( )。

#include<stdio.h>

#include<string.h>

main( )

char*s1="abDuj";

char*s2="ABdUG";

int t;

t=strcmp(s1,s2) ;

printf("%d",t);


A. 正数
B. 负数
C. 零
D. 不确定的值
[单项选择]下列程序的输出结果是( )。
#include<stdio.h>
#include<string.h>
main( )
char a[]="/n123//";
printf("%d,%d/n",strlen(a),sizeof(a));

A. 5,6
B. 5,5
C. 6,6
D. 6,5
[单项选择]下面程序的输出结果是( )。
#include<stdio.h>
#include<string.h>
main( )
char p1[]="WHO",p2[]="who",str[50]="xyz";
strcpy(str+1,strcat(p1,p2));
printf("%s",str);
A. xyzWHOwho
B. zWHOwho
C. zWHOwho
D. xWHOwho
[单项选择]下述程序的运行结果是( )。
#include<stdio.h>
#include<string.h>
main( )
char*s1="abDuj";
char*s2="ABdUG":
int t;
t=strcmp(s1,s2);
printf("%d",t);

A. 正数
B. 负数
C. 零
D. 不确定的值
[简答题]完成下面类中成员函数的定义。
#include<iostream>
#include<string>
using namespace std;
class str
private:
char*st;
public:
str(char*a)
set(a);
str&operator=(______)
delete st;
set(a.st);
return*this;

void show( )cout<<st<<endl;
~str( )delete st;
void set(char*s)//初始化st
______
strcpy(st,s);


void main( )
str s1("he"),s2("she");
s1.show( ),s2.show( );
s2=s1;
s1.show( ),s2.show( );

[简答题]有以下程序,其中函数f的功能是将多个字符串按字典顺序排序( )。
# include<string.h>
void f(char*p[],int n)
char*t;int i,j;
for(i=0;i<n-1;i++)
for(j=i+1;j<n;j++)
if(strcmp(p[i],p[j]>0)t=p[i];p[i]=p[j];p[j]=t;)

main( )
char *p[5]="abc" ,"aabdfg" ,"abbd", "dcdbe", "cd");
f(p,5);
printf("%d/n",strlen(p[1]));

程序运行后的输出结果是( )。
[填空题]以下程序运行后输入:3,abcde<回车>,则输出结果是______。
#include <string. h>
move (char *str,int n)
char cemp; int i;
temp=str[n-1];
for (i=n-1;i>0;i--) str[i]=str[i-1);
str[0]=temp;
main( )
char s[50]; int n, i, z;
scanf(“%d,%s”,&n,s);
z=strlen(s);
for (i=1; i<=n;i++)move (s,z);
printf(“%s/n”,s);

[单项选择]以下程序中函数f( )的功能是将n个字符串按由大到小的顺序进行排序。  #include<string.h>  void f(char p[ ][10],int n)  { char t[20]; int i,j;   for(i =O;i <n-1 ;i ++ )    for(j =i + 1 ;j < n;j ++ )     if(strcmp(p [i] ,p[j] ) <0)      { strcpy(t,p[i]);strcpy(p[i] ,p[j] );strcpy(p[j] ,t); } }  main ( )  { char p [ ] [ 10 ] = { "abc","aabdfg","abbd","dcdbe", "cd" }; int i;   f(p,5); printf("%d/n",strlen(p[O] ) );  }  程序运行后的输出结果是
A. 6
B. 4
C. 5
D. 3
[填空题]设有下列程序:
#include<stdio.h>
#include<string.h>
main( )
int i;
char s[10],t[10];
gets(t);
for(i=0;i<2;i++)
gets(s);
if(strcmp(t,s)<0)strcpy(t,s);

print f("%s/n",t);

程序运行后,从键盘上输入(<CR>代表回车符): DEF<CR>BADEF<CR>QTHRG<CR>,则程序的输出结果是______。

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码