云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > C语言习题集(平时练习含答案)1

C语言习题集(平时练习含答案)1

  • 62 次阅读
  • 3 次下载
  • 2025/5/7 6:46:23

struct student {

int age; int num;

}stu1,*p; p=&stu1;

A)stu1.age B)student . age C)p->age D) age 3.有如下定义: Struct date {

int year,month,day; };

Struct worklist {

Char name[20]; Char sex;

Struct date birthday; }person;

对结构体变量person的出生年份进行赋值时,下面正确的赋值语句是( ) 。

A year=1978 B birthday.year=1978 C person.birthday.year=1958 D person.year=1958 4.写出下列程序的输出结果: #include

37

struct info {int k; char *s; }t;

void f(struct info f) {t.k=1997; t.s=\}

void main() { }

5.若有以下的说明和语句,则表达式p->a的值是 struct we {int a; int *b; }*p;

int x0[]={11,12},x1[]={31,32}; struct we x[2]={100,x0,300,x1};

t.k=2000; t.s=\f(t);

printf(“%d,%s\\n”,t .k, t.s);

38

p=x;

6. 读懂以下语句的含义(有以下结构体说明和变量定义,实现链表的元素 删除和插入)。 struct node { int data; struct node *next; }

想要删除的节点指针q后面的节点 If(q->next) q->next=(q->next)->next; 在节点指针q后面添加节点r r.next=q->next; q->next=&r;

7.读懂以下程序(用于在结构体数组中查找分数最高和最低的同学姓名和成绩。) #include void main() {

int max,min,i,j; struct {

char name[8];

int score;}stud[5]={\李平\王兵\钟虎\孙逊\徐军\

39

}

max=min=1; for(i=1;i<5;i++)

if(stud[i].score >s tud[max].score)

max=i;

else if(stud[i].score

min=i;

printf(\最高分:%s %d\printf(\最低分:%s %d \

8. 读懂以下程序:(输入4本书的名称,单价,作者,出版社,按书名进行排版和输出。)

#include #include struct book { };

void main() {struct

book

bookarray[4]={{\

char bookname[40];/*书名*/ float price; /*单价*/ char author[10];/*作者*/ char press[40];/*出版社*/

40

搜索更多关于: C语言习题集(平时练习含答案)1 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

struct student { int age; int num; }stu1,*p; p=&stu1; A)stu1.age B)student . age C)p->age D) age 3.有如下定义: Struct date { int year,month,day; }; Struct worklist { Char name[20]; Char sex; Struct date birthday; }person; 对结构体变量person的出生年份进行赋值时,下面正确的赋值语句是( ) 。 A year=1978 B birthday.year=1978 C

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com