题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-21 17:26:31

[填空题]请补充fun函数,该函数的功能是:把一个整数转换成字符串,并倒序保存在字符数组S中。例如,当n=123时,s="321"。
注意:部分源程序已给出。
淆勿改动主函数main和其他函数中的任何内容,仅在main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
#define M 80
char s[M];
void fun(long int n)

int j=0;
while( (1) )

s[j]= (2)
n/=10;
j++;

(3)

main( )

long int n=1234567;
printf("The origial data/n");
printf("n=%1d",n);
fun(n);
printf("/n%s",s);


更多"请补充fun函数,该函数的功能是:把一个整数转换成字符串,并倒序保存在"的相关试题:

[简答题]填空题 请补充函数fun( ),该函数的功能是:把一个整数转换成字符串,并倒序保存在字符数组str中。例如:当n=13572468时,str=“86427531”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。 试题程序: #include #include #define N 80 char str[N]; void fun(long int n) { int i=0; while(【1】) { str[i]=【2】; n/=10; i++; } 【3】; } main( ) { long int n=13572468; clrscr( ); printf("*** the origial data ***/n"); printf("n=%ld",n); fun(n); printf("/n%s",str); }
[填空题]请补充fun函数,该函数的功能是:把一个整数转换成字符串,并倒序保存在字符数组S中。例如,当n=123时,s="321"。
注意:部分源程序已给出。
淆勿改动主函数main和其他函数中的任何内容,仅在main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
#define M 80
char s[M];
void fun(long int n)

int j=0;
while( (1) )

s[j]= (2)
n/=10;
j++;

(3)

main( )

long int n=1234567;
printf("The origial data/n");
printf("n=%1d",n);
fun(n);
printf("/n%s",s);


[填空题]请补充函数fun( ),该函数的功能是:把一个整数转换成字符串,并倒序保存在字符数组str中。例如:当n=13572468时,str=-“86427531”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
#include <conio.h>
#define N 80
char str[N];
void fun(long int n)

int i=0;
while( 【1】 )

str[i]= 【2】
n/=10;
i++;

【3】

main( )

long int n=13572468;
clrscr( );
printf("*** the origial data ***/n");
printf("n=%ld",n);
fun(n);
printf("/n%s",str);

[填空题]请补充函数fun( ),该函数的功能是:把从主函数中输入的由数字字符组成的字符串转换成—个无符号长整数,并且逆序输出。结果由函数返回。
例如,输入: 1 2 3 4 5 6,结果输出:6 5 4 3 2 1。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include<conio.h>
#include<stdio.h>
#include<string.h>
unsigned long fun(char *s)

unsigned long t=0;
int k;
int i=0;
i=strlen(s);
for( 【1】 ;i>=0;i--)

k= 【2】
t= 【3】

return t;
main( )

char str[8];
clrscr( );
printf("Enter a string made up of’0’to
’9’digital character:/n");
gets(str);
printf("The string iS:%S/n",str);
if(strlen(str)>8)
printf("The string is too long!");
else
printf("The result:%lu/n",
fun(str));

[简答题]请补充函数fun( ),该函数的功能是:只保留字符串中的大写字母,删除其他字符,结果仍保存在原来的字符串中,由全局变量m对删除后字符串的长度进行保存。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
int m;
void fun(char*s)

int i=0,j=0;
char *p=s;
while(*(p+i))

if(*(p+i)>=’A’&&*(p+i)<=’Z’)

(1)

(2)

s[j]=’/0’;
(3)

main( )

char str[80];
clrscr( );
printf("/nEnter a string:");
gets(str);
printf("/n/nThe string is:/%s/n",str);
fun(str);
printf("/n/nThe string of changing is: /%s/n",str);
printf("/n/nThe length of changed strtng is:/%d/n",m);

[填空题]请补充函数fun( ),该函数的功能是:把ASCⅡ码为偶数的字符从字符串s打中删除,结果仍然保存在字符串srt中,字符串str从键盘输入,其长度作为参数传入函数fun( )。
例如,输入“abcdef”,输出“ace”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#inc lude< stdio, h>
#define N 80
【1】

int i, j;
【2】
for (i=0;i<n;i++)

if (s [i] %2!=0)
s [j++]=s [i];

【3】 ;

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);

[单项选择]将一个数转换成相应字符串的函数是()。
A. Str
B. String
C. Asc
D. Chr
[填空题]str是一个由数字和字母字符组成的字符串,由变量num传入字符串长度。请补充函数fun( ),该函数的功能是:把字符串str中的数字字符转换成数字并存放到整型数组bb中,函数返回数组bb的长度。 例如:str=“Bcdl23e456hui890”,结果为:123456890。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #define N 80 int bb[N]; int fun(char s[ ],int bb[ ],int num) { int i,n=0; for(i=0;i<num;i++) { if( 【1】 ) { bb[n]= 【2】 ; n++; } } return 【3】 ; } main( ) { char str[N]; int num=0,n,i; printf("Enter a string:/n"); gets(str); while(str[num]) num++; n=fun(str,bb,num); printf("/nbb="); for(i=0;i<n;i++) printf("%d",bb[i]); }

我来回答:

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

订单号:

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