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

[填空题]请补充main函数,该函数的功能是:从键盘输入若干字符放到一个字符数组中,当桉回车键时结束输入,最后输出这个字符数组中的所有字符。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #include<ctype.h> main( ) { int i=0; char a [81]; char *p=s; clrscr ( ); printf{" Input a string /n"); for (i=0; i<80; i++) { s [i] =getchar ( ); if (s [i]==’/n’) 【1】; } s[i]= 【2】 printf(" display the string /n"); while (*p) putchar (【3】 ); }

更多"请补充main函数,该函数的功能是:从键盘输入若干字符放到一个字符数组"的相关试题:

[填空题]请补充main函数,该函数的功能是:从键盘输入若干字符放到一个字符数组中,当桉回车键时结束输入,最后输出这个字符数组中的所有字符。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<ctype.h>
main( )

int i=0;
char a [81];
char *p=s;
clrscr ( );
printf" Input a string /n");
for (i=0; i<80; i++)

s [i] =getchar ( );
if (s [i]==’/n’)
【1】;

s[i]= 【2】
printf(" display the string /n");
while (*p)
putchar (【3】 );

[填空题]请补充main函数,该函数的功能是:从键盘输入3个整数,然后找出最大的数并输出。
例如,输入:12,45,43,最大值为45。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
main( )

int a, b, c, max;
clrscr( );
printf("/nlnput three numbers:/n");
scanf("%d,%d,%d",&a,&b,&c);
printf("The three numbers are:%d,
%d,%d/n",a,b,c);
if(a>b)
【1】 ;
else
【2】 ;
if(max<c)
【3】 ;
printf("max=%d/n",max);

[填空题]请补充main函数,该函数的功能是:从键盘输入3个整数,然后找出最大的数并输出。 例如,输入:12,45,43,最大值为45。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #include<conio.h> main( ) { int a, b, c, max; clrscr( ); printf("/nlnput three numbers:/n"); scanf("%d,%d,%d",&a,&b,&c); printf("The three numbers are:%d, %d,%d/n",a,b,c); if(a>b) 【1】 ; else 【2】 ; if(max<c) 【3】 ; printf("max=%d/n",max); }
[填空题]请补充main函数,该函数的功能是:从键盘输入一组整数,使用条件表达式找出最大的整数。当输入的整数为0时结束。
例如,输入1,2,3,5,4,0时,最大的数为5。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写出的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
#define N 100
main( )

int num[N];
int i=-1;
int max=0;
clrscr( );
printf("/nInput integer number:/n");
do

i++;
printf("num[%d]=",i);
scanf("%d", 【1】 );
max= 【2】 num[i]:max;
while ( 【3】 );
printf("max=%dkn",max);

[填空题]请补充main函数,该函数的功能是:从键盘输入一组字符串,以‘*’结束输入,并显示出这个字符串。 例如,输入abcdefghi*,结果显示adcdefghi。 注意:部分源程序给出如下. 请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio. h> #define N 80 main ( ) { iht i=-l, j=0; char str IN]; clrscr ( ); printf("/n Input a string /n"); do { i++; scanf(【1】); }while(【2】); printf ("/n**display the string** /n"); while (j<i) { printf (【3】); j++; } }
[填空题]请补充main函数,该函数的功能是:从键盘输入一个字符串并保存在字符str1中,把字符串str1中下标为偶数的字符保存在字符串str2中并输出。例如,当str1=“cdefghij”,则 str2=“cegi”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
#define LEN 80
main( )

char str1[LEN],str2 [LEN];
char *p1=str1,*p2=str2;
int i=0,j=0;
clrscr( );
printf("Enter the string:/n");
scanf( 【1】 );
printf("***the origial string***/n");
while(*(p1+j))

printf(" 【2】 ",*(p1+j));
j++;

for(i=0;i<j;i+=2)
*p2++=*(str1+i);
*p2=’/0’;
printf("/nThe new string is:%s/n", 【3】 );

[多项选择]填空题 请补充main函数,该函数的功能是:从键盘输入一个字符串并保存在字符str1中,把字符串str1中下标为偶数的字符保存在字符串str2中并输出。例如,当str1=“cdefghij”,则str2=“cegi”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun( )的横线上填入所编写的若干表达式或语句。 试题程序: #include #include #define LEN 80 main( ) { char str1[LEN],str2[LEN]; char *p1=str1,*p2=str2; int i=0,j=0; clrscr( ); printf("Enter the string:/n"); scanf(【1】); printf("***the origial string***/n"); while(*(p1+j)) { printf("【2】",*(p1+j)); j++; } for(i=0;i
[填空题]请补充main函数,该函数的功能是:从键盘输入一个字符串及一个指定字符,然后把这个字符及其后面的所有字符全部删除。结果仍然保存在原串中。 例如,输入“abcdef”,指定字符为‘e’,则输出“abcd”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。 试题程序: #include <stdio. h> #define N 80 main ( ) { int i=0; char str [N]; char ch; clrscr ( ); printf{"/n Input a string:/n"); gets (str); printf("kn Input a charator;/n"); scanf ("%c", &ch); while (str [i] !=’/0’) { if (str [i]==ch) 【1】 【2】 ; } str[i]= 【3】 ; printf{"/n*** display string ***/n"); puts (str); }
[填空题]请补充main函数,该函数的功能是:从键盘输入学生的成绩(用回车键作为分隔符),并统计各分数段学生的人数。具体要求为:A类为90~100分,B类为80~89分,C类为70~79分,D类为60~69分,59分以下的为E类。当成绩为0时结束成绩的输入,并且最后输入的0不进行统计。
例如,输入89,99,45,64,56,78,88,74,66,55,0。结果为
A:1 B:2 C://2 D://2 E://3
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
#define N 100
main( )

float score[N];
int bb[5];
int grade, i=-1,n=0;
char ch=’A’;
clrscr( );
printf("Input a score(0~100);/n");
do

i++;
n++;
printf("score[%d]=",i);
scanf ( 【1】 );
while (score[i]!=0);
for(i=0;i<5;i++)
【2】 ;
for(i=0;i<n-1;i++)

grade= 【3】 ;
switch(grade)

case 10:
case 9:bb[0]++;break;
case 8:bb[1]++;break;
case 7:bb[2]++;break;
case 6:bb[3]++; break;
default:bb[4]++;

我来回答:

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

订单号:

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