AI智能整理导入 AI智能整理导入
×
首页 题库中心 c语言程序设计题库 题目详情
CA85E835B92000012B50FB49F93816B5
c语言程序设计题库
1,073
单选题

将一个整数插入原来的一个有序数组中。

#include "stdio.h"
void main() {
int a[11]={1,3,5,7,9,11,13,15,17,19},num,i,j;
for (i=0;i<10;i++) printf("%5d",a[i]);
printf("\n");
printf("\ninput want insert number:");
scanf("%d",______【1】_______);
if (num>=a[9]) a[10]=num;
else
for(i=0;i<10;____【2】_____) {
if(num<=a[i]) {
for(j=10;j>i;j--)
______【3】______;
a[i]=num;
______【4】______;
}
}
for(i=0;i<11;i++)
printf("%5d",a[i]);
printf("\n");
}

A
&num
B
i++ i=i+1 i+=1
C
a[j]=a[j-1]
D
break

答案解析

正确答案:ABCD

解析:

数组
c语言程序设计题库

扫码进入小程序
随时随地练习

相关题目

单选题

以下叙述中正确的是( )。

单选题

结构化程序所要求的基本结构不包括( )。

单选题

在以下给出的表达式中,与while(E)中的(E)不等价的表达式是( )。

单选题

有以下程序
#include
#include
void fun(double *p1,double *p2,double *s)
{
s = (double *)calloc( 1,sizeof(double) );
*s = *p1 + *( p2+1 );
}
main()
{
double a[2] = { 1.1, 2.2 }, b[2] = { 10.0, 20.0 }, *s=a;
fun(a, b, s);
printf("%5.2f\n", *s);
}
程序的输出结果是( )。

单选题

以下能正确表述算式 sin(2πr+30°)的C语言表达式是( )。

单选题

有以下程序
#include
main()
{
char b,c;
int i;
b='a';
c='A';
for(i=0;i<6;i++)
{
if (i%2) putchar(i+b);
else
putchar(i+c);
}
printf("\\n");
}
程序运行后的输出结果是( )。

单选题

有以下程序
#include
int m1(int x,int y)
{
return x<=y ? x :y;
}
int m2(int x,int y)
{
return x<=y ? y :x;
}
int fun(int a,int b)
{
return a+b;
}

main()
{
int x=2,y=3,z=1;
printf("%d\n", fun(m1(x,y),m2(y,z)));
}
程序的运行结果是( )。

单选题

关于C语言标识符,以下叙述错误的是( )。

单选题

有以下程序
#include
main()
{
int i,j = 0;
char a[] = "How are you", b[10] = {0};
for (i=0; a[i]; i++)
if (a[i] == ' ')
b[j++] = a[i+1];
printf("%s\n",b);
}
程序运行后的输出结果是( )。

单选题

有以下程序
#include
#include
struct S
{
char name[10];
};

void change(struct S *data, int value)
{
strcpy(data->name, "#");
value = 6;
}

main()
{
struct S input;
int num = 3;
strcpy(input.name, "OK");
change(&input, num);
printf("%s,%d\n", input.name, num);
}
程序运行后的输出结果是( )。

关闭
专为自学备考人员打造
试题通
自助导入本地题库
试题通
多种刷题考试模式
试题通
本地离线答题搜题
试题通
扫码考试方便快捷
试题通
海量试题每日更新
试题通
欢迎登录试题通
可以使用以下方式扫码登陆
试题通
使用APP登录
试题通
使用微信登录
xiaochengxu
联系电话:
400-660-3606
xiaochengxu