题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-12-21 18:50:22

[填空题]请补充main函数,该函数的功能是:打印出1~1000中满足:个位数字的立方等于其本身所有数。
本题的结果为;1 64 125 216 729
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数main的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio .h>
main ( )

int i,g;
clrscr ( );
for (i=1; i<1000; i++)

g= 【1】 ;
if( 【2】 )
printf ("%4d", i);


更多"请补充main函数,该函数的功能是:打印出1~1000中满足:个位数字"的相关试题:

[填空题]请补充main函数,该函数的功能是:打印出1~1000中满足:个位数字的立方等于其本身所有数。 本题的结果为;1 64 125 216 729 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数main的横线上填入所编写的若干表达式或语句。 试题程序: #include <stdio .h> main ( ) { int i,g; clrscr ( ); for (i=1; i<1000; i++) { g= 【1】 ; if( 【2】 ) printf ("%4d", i); } }
[填空题]请补充main( )函数,该函数的功能是:打印出1~10000中满足个位数字的立方等于其本身的所有数。
本题的结果为:1 64 125 216 729
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容。
试题程序:
#include<stdlib.h>
#include<stdio.h>
void main( )

int i, k;
system("CLS");
for(i=1; i<10000; i++)

k= (1) ;
if( (2) )
printf("%4d", i);



[填空题]请补充函数fun( ),该函数的功能是判断一个数的个位数字和百位数字之和是否等于其十位上的数字,是则返回"yes!”,否则返回“no!”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include <stdio.h> #include <conlo.h> char *fun(int n) {   int g,s,b; g=n%l0; s=n/10%10; b= 【1】 ; if((g+b)==s) return 【2】 ; else return 【3】 ; } main( ) { int num=0; clrscr( ); printf("******Input data*******/n"); scanf("%d",&num); printf("/n/n/n"); printf("******The result*******/n"); printf("/n/n/n%s",fun(num)); }
[填空题]请补充main函数,该函数的功能是:打印出满足个位的数字、十位上的数字和百位上的数字都相等的所有二位数。
本题的结果为:111 222 333 444 555 666 777 888 999。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
main ( )

int g, s, b;
clrscr );
for(g=1; g<10; g++)
for (s=1; s<10; s++)
for(b=l; b<10; b++)

if( 【1】 )
printf("%5d", 【2】 );


[填空题]请补充fun( )函数,fun函数的功能是求m的阶乘。 请勿改动main( )函数与其他函数中的任何内容,仅在fun( )函数的横线上填写所需的若干表达式语句。 注意:部分源程序给出如下。 试题程序: #include<stdio.h> long fun(int m) { if(______) return(m*fun(______)); return ______; } void main( ) { printf("8!=%ld/n",fun(8)); }

[填空题]请补充函数fun( ),该函数的功能是:把从主函数中输入的字符串str2接在字符串str1的后面。
例如:str1=“How do”,str2=“you do”,结果输出:How do you do
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
#define N 40
void fun(char *str1,char *str2)

int i=0;
char *p1=str1;
char *p2=str2;
while( 【1】 )
i++;
for( ; 【2】 ;i++)
*(p1+i)= 【3】
*(p1+i)=’/0’;
main( )

char str1[N],str2[N);
clrscr( );
printf("*****Input the string str1 & str2*****/n");
printf("/nstr1:");
gets(str1);
printf("/nstr2:");
gets(str2);
printf("**The string str1 & str2**/n");
puts(str1);
puts(str2);
fun(str1,str2);
printf("*****The new string *****/n");
puts(str1);

[填空题]请补充函数fun( ),该函数的功能是判断一个数是否为回文数。当字符串是回文时,函数返回字符申:yes!,否则函数返回字符串:no!,并在主函数中输出。所谓回文即正向与反向的拼写都一样,例如:abcba。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include<string.h>
#include<stdio.h>
char *fun(char*str)

char *p1,*p2;
int i, t=0;
p1=str;p2=str+strlen(str)-1;
for (i=0; 【1】 ;i++)
if( 【2】 )

t=1;
break;

if ( 【3】 )
return("yes!");
else
return("no!");
main( )

char str[50];
printf("Input;");
scanf("%s",str);
printf("%s/n",fun(str));

[填空题]请补充函数proc( ),该函数的功能是判断一个数是否为回文数。当字符串是回文数时,函数返回字符串:yes!,否则函数返回字符串:no!,并在主函数中输出。所谓回文即正向与反向的拼写都一样,例如,abcdcba。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容。
试题程序:
#include<string.h>
#include<stdio.h>
char *proc(char*str)

char *str1, *str2;
int i, t=0;
str1=str; str2=str+str1en(str)-1;
for(i=0; (1) ; i++)
if( (2) )

t=1;
break;

if( (3) )
return("yes!");
else
return("no!");

void main( )

char str[50];
printf("Input: ");
scanf("%s", str);
printf("%s/n", proc(str));


[填空题]请补充函数fun( ),该函数的功能是把数组bb中的数按从小到大的排列(数组的值及元素个数从土函数中输入)。
例如,输入2 3 5 4 1,结果为1 2 3 4 5。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )吧的横线上填入所编写的若干表达式或语句。
试题程序:
# include<stdio. h>
# define N 100
void fun(int bb[], int n)

int i,j,t;
for (i=0; 【1】 ;i++)
for(j=0; 【2】 ;j++)
if(bb[j]>bb[j+1] )

t=bb[j];
bb [j]=bb [j+1];
bb[j+1]=t;


main( )

int i=0, n=0;
int bb[N];
clrscr ( );
printf("/nInput n: /n");
scanf ("%d", &n);
printf ("/nInput data: /n");
while (i<n)

printf ("bb [%d] =", i);
scanf ("%d", &bb [i]);
i++;

fun (bb, n);
printf("/n*** the result ***/n");
for (i=0; i<n; i++ )
printf ( "%4d’’, bb [i]);

[填空题]请补充函数proc( ),该函数的功能是比较字符串str1和str2的大小,并返回比较的结果。 例如,当str1="abcd",str2="abcc"时,函数proc( )返回“>”,比较结果为“str1>str2”。 注意:部分源程序给出如下。 请勿改动main( )函数和其他函数中的任何内容,仅在函数proc( )的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdlib.h> #include<stdio.h> #include<conio.h> #define M 80 char*proc(char*str1,char*str2) { char*p1=str1,*p2=str2; while(*p1&&*p2) { if(______) return"<"; if(______) return">"; p1++; p2++; } if("p1==*p2) return"=="; if(*p1==______) return"<"; else return">"; } void main( ) { char str1[M],str2[M]; system("CLS"); printf("Input str1:/n"); gets(str1); printf("Input str2:/n"); gets(str2); printf("/n****the result****/n"); printf("/nstr1%s str2",proc(str1,str2)); }

[填空题]请补充函数fun( ),该函数的功能是:判断某一个年份是否为闰年。
例如,1900年不是闰年,2004是闰年。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
int fun(int n)

int flag=0;
if (n%4=0)

if ( 【1】 )
flag=1;

if ( 【2】 )
flag=1;
return 【3】 ;

main( )

int year;
clrscr( );
printf("Input the year:");
scanf("%d", &year);
if (fun(year))
printf("%d is a leap year. /n", year);
else
printf("%d is not a leap year./n",
year);

[填空题]请补充main( )函数,该函数的功能是:从键盘输入一个字符串并保存在字符str1中,把字符串str1中下标为偶数的字符保存在字符串str2中并输出。例如,当str1="computer",则str2="cmue"。 注意:部分源程序给出如下。 请勿改动函数中的任何内容,仅在横线上填入所编写的若干表达式或语句。 试题程序: #include<stdlib.h> #include<stdio.h> #include<conio.h> #define LEN 80 void main( ) { char str1[LEN],str2[LEN]; char*p1=str1,*p2=str2; int i=0,j=0; system("CLS"); printf("Enter the string:/n"); scanf(______); printf("***the origial string***/n"); while(*(p1+j)) { printf("______",*(p1+j)); j++; } for(i=0;i<j;i+=2) *p2++=*(str1+i); *p2="/0"; printf("/nThe new string is:%s/n",______); }

[填空题]请补充main( )函数,该函数的功能是:把1~100的所有素数保存在数组arr中,然后输出这些素数并计算它们的和。 注意:部分源程序给出如下。 请勿改动main( )函数和其他函数中的任何内容,仅在main( )函数的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdlib.h> #include<stdio.h> void main( ) { int i,j,k,flag,sum; int arr[50]; sum=0; k=0; system("CLS"); for(i=2;i<100;i++) { ______; for(j=2;j<i&&flag;j++) if(i%j==0) { ______; } if(flag) { sum+=i; ______; } } printf("/n***prime nHmber***/n"); for(i=0;i<k;i++) { if(i%10==0) printf("/n"); printf("%4d",arr[i]); } printf("/nsum=%d",sum); }

[填空题]请补充函数fun( ),该函数的功能是:把ASCII码为奇数的字符从字符串str中删除,结果仍然保存在字符串str中。字符串str从键盘输入,其长度作为参数传入函数fun( )。 例如,输入“abcdef”,输出“bdf”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include <stdio.h> #define N 80 void fun(char s[],int n) { int i, j; j=0; for(i=0; 【1】 ;i++) { if( 【2】 ) 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); }

我来回答:

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

订单号:

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