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

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

A
C语言规定必须用main作为主函数名,程序将从此开始执行
B
可以在程序中由用户指定任意一个函数作为主函数,程序将从此开始执行
C
C语言程序将从源程序中第一个函数开始执行
D
main的各种大小写拼写形式都可以作为主函数名,如:MAIN,Main等

答案解析

正确答案:A

解析:

C语言基础与数据类型
c语言程序设计题库

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

相关题目

单选题

当运行以下程序时 , 从键盘输入My BooK (
# include
char fun(char *s)
{
if(*s='A')*s+=32;return *s;
}


main ( )
{ char c[80],*p;
p=c;
scanf("%s",p);
while(*p){*p=fun(p);putchar(*p);p++;}
printf("\\n");
}

单选题

下面的程序是计算一组学生的平均成绩和不及格人数,请根据题目要求填空。

include "stdio.h"

struct student
{
t id;
har name[20];
char sex;
float score;}stu1[5]=
{
{101,"Li ping",'M',45},
{102,"Zhang ping",'M',62.5},
{103,"He fang",'F',92.5},
{104,"Cheng ling",'F',87},
{105,"Wang ming",'M',58},
};


main()
{
struct student *ps;
void ave(struct student *ps);
_____【1】_________________;
ave(ps);
}


void ave(struct student *ps)
{
int c=0,i;
float ave,s=0;
for(i=0;i<5;_____【2】_____________)
{
s+=ps->score;
if(ps->score<60) _____【3】_____________;
}
printf("s=%f\n",s);
_____【4】_____________;
printf("average=%f\ncount=%d\n",ave,c);
}



单选题

下面的程序输入4名学生的学号、姓名和成绩,然后输出成绩最高的学生的学号、姓名和成绩。将程序补充完整。
#include "stdio.h"


main()
{
struct student
{
int id;
char name[20];
float score;
};
struct student stu[4];
_____【1】_____________;
int i,temp=0;
float max;
for(i=0;i<4;i++)
scanf("%d%s%f",____【2】_________,&stu[i].name,&stu[i].score);
for(max=stu[0].score,i=1;i<4;i++)
if(____【3】_________)
{max=stu[i].score;temp=i;}
____【4】_________;
printf("\nThe maximum score:\n");
printf("No.:%d\nname:%s\nscore:%4.1f\n",p->id,p->name,p->score);
}

单选题

设有若干个人员的数据,其中有学生和教师。学生的数据中包括:姓名、号码、性别、职业、班级。教师的数据包括:姓名、号码、性别、职业、职务。现要求把它们放在同一表格中。请填空完成程序。

#include
struct
{ int num;
char name[10];
char sex;
char job;
_______【1】________
{ int banji;
char position[10];
} category;
} person[2];
void main( )
{ int n,i;
for(i=0;i<2;i++)
{ scanf(“%d,%s,%c,%c”,&person[i].num,&person[i].name,&person[i].sex,_______【2】_________);
if(person[i].job==‘s’) scanf(“%d”,&person[i].category.banji);
else if(person[i].job==‘t’) scanf(“%s”,&person[i].category.position);
else printf(“input error”);
}
printf(“\n”);
printf(“No. Name sex job class/position\n”);
for(i=0;i<2;i++)
{ if(_______【3】__________)
printf(“%-6d %-10s %-3c %-3c %-6d\n”,person[i].num,person[i].name,
person[i].sex, person[i].job, person[i].category.banji);
else
printf(“%-6d %-10s %-3c %-3c %-6s\n”,person[i].num,person[i].name,
person[i].sex, person[i].job, ________【4】____________);
}
}

单选题

下面的代码实现将一个节点插入到链表中,其中结构体名称为student,请填空。

struct student *insert(______【1】_______, struct student *stud)
{ struct student *p0, *p1, *p2;
p1=head;
p0=stud;
if(head==NULL) {head=p0;______【2】________; break;}
while(p1!=NULL)
{
if (p0->numnum) break;
________【3】___________;
p1=p1->next;
}
if (p1==head) head=p0;
else p2->next=p0;
p0->next=p1;
______【4】_________;
return(head);
}

单选题

下面的代码实现建立一个有若干名学生数据的单向动态链表,请填空。

#include
#include
#define LEN sizeof(struct student)
struct student
{ long num;
float score;
struct student * next;
};
int n;
struct student *creat();
void print(struct student * p);
main()
{
struct student *head;
________【1】__________;
display(head);
}
void print(struct student * p)
{
while(p)
{ printf("%ld\t%f\n",p->num, p->score);
_______【2】________; }
}


struct student *creat()
{
struct student *p1,*p2,*head;
long sno;
float score;
p1=p2=head=NULL;
______【3】_________;
while(1)
{ scanf("%ld,%f",&sno,&score);
if(sno==0) break;
n++;
p1=(struct student*)malloc(LEN);
p1->num=sno;
p1->score=score;
if(head==NULL)
head=p1;
else
_________【4】____________;
p2=p1;
}
if(p2) p2->next=NULL;
return head;
}

单选题

下面的函数实现删除动态链表中指定的结点,以学号num作为删除结点的标志(查找对象)。请填空。

struct student *del(struct student *head,long num)
{ struct student *p1,*p2;
if(______【1】_______) {printf(“\\n list null ! \\n”); return(head); }
p1=head;
while(num !=p1->num && p1->next != NULL)
{ _____【2】______; p1=p1->next; }
if(num == p1->num)
{ if(p1 = = head) head=p1->next;
else __________【3】____________;
printf(“delete: %d\\n”,num);
n=n-1;
________【4】_________;
}
else printf(“%ld not been found ! \\n”,num);
return(head);
}

单选题



___________【1】_______________
#include
void main()
{ int s;
float n,t,pi;
t=1; pi=0; n=1.0; s=1;
while((______【2】________)
{ pi=pi+t;
n=n+2;
s= -s;
_____【3】_______;
}
_______【4】________;
printf("pi=%10.6f\n",pi);
}

单选题

求100~200间的全部素数。

#include
________【1】__________
void main()
{ int m, k, i, n=0;
for(m=101;______【2】_______;m=m+2)
{ k=sqrt(m);
for(i=2;i<=k;i++)
if(m%i==0) ______【3】_______;
if(i>k) {printf("%d",m);______【4】________;}
if(n%10==0) printf("\n");
}
printf("\n");
}

单选题

用起泡法对10个数排序(由小到大)。

#define n 10
#include
void main()
{ int a[n],i,j,t;
printf("Input 10 numbers:\n");
for(i=0;_______【1】__________;i++)
scanf("%d",&a[i]);
printf("\n");
for(j=0;j<=n-2;j++)
for(i=0;_______【2】________;i++)
if(a[i]>a[i+1])
{t=a[i]; ______【3】________; a[i+1]=t;}
printf("The sorted numbers:\n");
for(i=0;i<=9;i++)
printf("%d ",______【4】________);
}

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