题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-11-06 01:51:30

[填空题]输入任意长度的字符串,要求将字符顺序倒置,例如,将输入的“ABCDE”变换成“EDCBA”。请把程序补充完整。
Private Sub Command1_Click
Dim a$,i%,c$,d$
a=InputBox$(“输入仟意字符串”)
n=Lea(A)
For i=1 to______
c=Mid(a,i,1)
Mid(a,i,1)=______
______=c
Next i
Print a
End Sub

更多"输入任意长度的字符串,要求将字符顺序倒置,例如,将输入的“ABCDE”"的相关试题:

[简答题]输入任意长度的字符串,要求将字符顺序倒置,例如,将输入的“ABCDE”变换成 “EDCBA”。请把程序补充完整。 Private Sub Commandl_Click Dim a$,i%,c$,d$ a=InputBox$(“输入任意字符串”) n=Len(a) For i=1 to______________ c=Mid(a.i.1) Mid(a,i,1)=______________ ______________=c Next i Printa End Sub
[填空题]字符串str由数字字符组成(长度不超过5个字符),可看作任意进制的数,请补充函数fun( ),该函数的功能是:把 str字符串转换成任意进制的数,结果保存在数组xx中,由函数返回转换后数组腆的实际长度。其中x表示str原来的进制, y表示要转换成的进制。例如,输入str=“1111”,x=2,y=10,结果输出:15。如果输入str=“15”, x=10,Y=2,结果输出: 1111。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include <stdio.h> #include<stdlib.h> #include<string.h> #define N 8 int xx[N]; int fun(char *str,int x,int y) { int sum; int i=0; char *p=str; for(i=0; i<N; i++) xx[i]=0; sum=*p-’0’; p++; while (*p) { sum= 【1】 ; p++; } i=0; while(sum!=0) { xx[i]= 【2】 ; 【3】 ; i++; } return i; } main ( ) { char str[6]; int i; int n; int x; int y; printf("Enter a string made up of ’0’ to ’9’ digits character:"); gets(str); if(strlen (str) >5) { printf("Error:string too longer!, please input again!/n/n"); exit(0); } for(i=0;str[i];i++)
[填空题]字符串str由数字字符组成(长度不超过5个字符),可看做任意进制的数,请补充函数proc( ),该函数的功能是:把str字符串从二进制转换为十进制的数,结果保存在数组xx中,由函数返回转换后数组xx的实际长度。其中x表示str原来的进制,y表示要转换成的进制。例如,输入str="1011", x=2,y=10,结果输出:11。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容。
试题程序:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define M 8
int xx[M];
int proc(char*str, int x, int y)

int sum;
int i=0;
char *p=str;
for(i=0; i<M; i++)
xx[i]=0;
sum= (1) ;
p++;
while(*p)

sum=sum*x+*p-’0’;
p++;

i=0;
while(sum!=0)

xx[i]= (2) ;
(3) ;
i++;

return i;

void main( )

char str[6];
int i;
int n;
int x;
int y;
printf("Enter a string made up of ’0’ to ’9’ digits character: ");
gets(str);
if(strlen(Str)>5)

printf("Error: string too longer!, please input again!/n/n");
exit(0);

for(i=0; slr[i]; i++)
if(str[i]<
[简答题]编写一个函数,用该函数可以统计一个长度为3的字符串在另一个字符串中出现的次数。例如,假定输入字符串“the abcthe they have theren”,子字符串为“the”,则应输出4。
注意:部分源程序在文件PROC2.CPP中。
请勿改动主函数和其他函数中的任何内容,仅在fun( )的花括号中填入编写的若干语句。
部分源程序如下:
//PROC2.CPP
#include <iostream>
using namespace std;
#define MAX 100
int fun(char *str,char *substr);
int main( )
char str[MAX],substr[3];
int n;
cout<<"Please Input the source String/n";
cin>>str;
cout<<"Please Input the subString/n";
cin>>substr;
n=fun(str, substr);
cout<<"The counter is: "<<n<<end1;
return 0;

int fun(char *str,char *substr)

//******

[简答题]编写一个函数,该函数可以统计一个长度为2的字符串在另一个字符串中出现的次数。例如,假定输入的字符串为asd asasdfg asd as zx67 asd mklo,子字符串为as,则应当输出6。
注意:部分源程序给出如下。
请勿改动主函数main和具他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <conio.h>
#include <stdio.h>
#include <string.h>
int fun(char *str, char *substr)


main ( )

char str[81],substr[3];
int n;
clrscr ( );
printf ("输入主字符串 ");
gets (str);
printf ("输入子字符串");
gets (substr);
puts (str);
puts (substr);
n=fun (shr, substr);
printf("n=%d/n ",n);

[填空题]以下程序的功能是将字符串s中的数字字符放入d数组中,最后输出d中的字符串。例如,输入字符串:abcl23edf456gh,执行程序后输出:123456。请填空。
#include <stdioo.h>
#include <ctype.h>
main( )
char s[80],d[80]; int i,j;
gets(s);
for(i=j=0;s[i]!=’/0’;i++)
if( 【20】 )d[j]=s[i];j++;
d[j]=’/0’;
puts(d);
[填空题]一个8字符字符串,头两个字符任意,之后必须为两个零,然后是4位任意数字,有效性规则表达式可以表示为______。
[填空题]以下函数将b字符串连接到a字符串的后面,并返回a中新字符串的长度。
strcen(char aC), char b[])
int num=0,n=0;
while(*(a+num)!= 【14】 ) num++;
while(b[n])*(a+num)=b[n]; num++; 【15】 ;)
return(num);

[填空题]以下程序的功能是将字符串s中的数字字符放入d数组中,最后输出d中的字符串。例如,输入字符串:abc123edf456gh,执行程序后输出:123456。请填空。   #include  <stdio.h>   #include  <ctype.h>   main( )   { char s[80], d[80]; int i,j;    gets(s);    for(i=j=0;s[i]!=’’/0’’;i++)      if(【 】) { d[j]=s[i]; j++; }    d[j]=’’/0’’;    puts(d);   }

我来回答:

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

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码