c语言程序设计中国铁道答案(C语言程序设计中国铁道出版社答案)

程序设计 1892
今天给各位分享c语言程序设计中国铁道答案的知识,其中也会对C语言程序设计中国铁道出版社答案进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!本文目录一览: 1、

今天给各位分享c语言程序设计中国铁道答案的知识,其中也会对C语言程序设计中国铁道出版社答案进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

书后答案!谁有C语言程序设计(第二版)夏宽理、赵子正,中国铁道出版社。书后答案。悬赏分全部奉上

我们这本书是夏宽理 赵子正,中国铁道出版社的。请大家帮帮忙,我要重修啊推荐谭浩强的 如满意请及时采纳 我的空间还有C视频教程、书本,楼主可

C语言课程设计~~~ 要求编写一段程序,题目是《校际运动会管理系统》

我这是源代码已经调试过了,在VC++上运行成功了。

#include "stdio.h" /*I/O函数*/

#include "stdlib.h" /*其它说明*/

#include "string.h" /*字符串函数*/

#include "conio.h" /*屏幕操作函数*/

#include "mem.h" /*内存操作函数*/

#include "ctype.h" /*字符操作函数*/

#include "alloc.h" /*动态地址分配函数*/

struct score

{

int mingci;

char xuehao[8];

char mingzi[20];

float score[6];

}data,info[1000];

int i,j,k=0;

char temp[20],ch;

FILE *fp,*fp1;

void shuru()

{

if((fp=fopen("s_score.txt","ab+"))==NULL)

{

printf("cannot open this file.\n");

getch();exit(0);

}

for(i=0;i=1000;i++)

{

printf("\nPlease shuru xuehao:");

gets(data.xuehao);

printf("Please shuru mingzi:");

gets(data.mingzi);

printf("Please shuru yuwen score:");

gets(temp);data.score[0]=atof(temp);

printf("Please shuru shuxue score:");

gets(temp);data.score[1]=atof(temp);

printf("Please input yingyu score:");

gets(temp);data.score[2]=atof(temp);

printf("Please shuru wuli score:");

gets(temp);data.score[3]=atof(temp);

printf("Please shur huaxue score:");

gets(temp);data.score[4]=atof(temp);

data.score[5]=data.score[0]+data.score[1]+data.score[2]+data.score[3]+data.score[4];

fwrite(data,sizeof(data),1,fp);

printf("another?y/n");

ch=getch();

if(ch=='n'||ch=='N')

break;

} fclose(fp);

}

void xianshi()

{

float s;int n;

if((fp=fopen("s_score.txt","rb+"))==NULL)

{

printf("Cannot reading this file.\n");

exit(0);

}

for(i=0;i=1000;i++)

{

if((fread(info[i],sizeof(info[i]),1,fp))!=1)

break;

}

printf("\nxuehao mingzi yuwen shuxue yingyu wuli huauxue zhongfen\n");

for(j=0,k=1;ji;j++,k++)

{

info[j].mingci=k;

printf("%6s %8s %3.1f %3.1f %3.1f %3.1f %3.1f %3.1f\n",info[j].xuehao,info[j].mingzi,info[j].score[0],info[j].score[1],info[j].score[2],info[j].score[3],info[j].score[4],

info[j].score[5]);

}

getch();

fclose(fp);

}

void xiugai()

{

if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL)

{

printf("Cannot open this file.\n");

exit(0);

}

printf("\nPLease shuru xiugai xuehao:");

scanf("%d",i); getchar();

while((fread(data,sizeof(data),1,fp))==1)

{

j=atoi(data.xuehao);

if(j==i)

{

printf("xuehao:%s\nmingzi:%s\n",data.xuehao,data.mingzi);

printf("Please shuru mingzi:");

gets(data.mingzi);

printf("Please shuru yuwen score:");

gets(temp);data.score[0]=atof(temp);

printf("Please shuru shuxue score:");

gets(temp);data.score[1]=atof(temp);

printf("Please input yingyu score:");

gets(temp);data.score[2]=atof(temp);

printf("Please input wuli score:");

gets(temp);data.score[3]=atof(temp);

printf("Please input huaxue score:");

gets(temp);data.score[4]=atof(temp);

data.score[5]=data.score[0]+data.score[1]+data.score[2]+data.score[3]+data.score[4];

} fwrite(data,sizeof(data),1,fp1);

}

fseek(fp,0L,0);

fseek(fp1,0L,0);

while((fread(data,sizeof(data),1,fp1))==1)

{

fwrite(data,sizeof(data),1,fp);

}

fclose(fp);

fclose(fp1);

}

void chazhao()

{

if((fp=fopen("s_score.txt","rb"))==NULL)

{

printf("\nCannot open this file.\n");

exit(0);

}

printf("\nPLease shuru xuehao chakan:");

scanf("%d",i);

while(fread(data,sizeof(data),1,fp)==1)

{

j=atoi(data.xuehao);

if(i==j)

{

printf("xuehao:%s mingzi:%s\nyuwen:%f\n shuxue:%f\n yingyu:%f\n wuli:%f\n huaxue:%f\n ",data.xuehao,data.mingzi,data.score[0],data.score[1],data.score[2],data.score[3],data.score[4],data.score[5]);

}getch();

}

}

void shanchu()

{

if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL)

{

printf("\nopen score.txt was failed!");

getch();

exit(0);

}

printf("\nPlease input ID which you want to del:");

scanf("%d",i);getchar();

while((fread(data,sizeof(data),1,fp))==1)

{

j=atoi(data.xuehao);

if(j==i)

{

printf("Anykey will delet it.\n");

getch();

continue;

}

fwrite(data,sizeof(data),1,fp1);

}

fclose(fp);

fclose(fp1);

remove("s_score.txt");

rename("temp.txt","s_score.txt");

printf("Data delet was succesful!\n");

printf("Anykey will return to main.");

getch();

}

main()

{

while(1)

{

clrscr(); /*清屏幕*/

gotoxy(1,1); /*移动光标*/

textcolor(YELLOW); /*设置文本显示颜色为黄色*/

textbackground(BLUE); /*设置背景颜色为蓝色*/

window(1,1,99,99); /* 制作显示菜单的窗口,大小根据菜单条数设计*/

clrscr();

printf("*************welcome to use student manage******************\n");

printf("*************************menu********************************\n");

printf("* ========================================================= * \n");

printf("* 1shuru 2xiugai * \n");

printf("* 3shanchu 4chazhao * \n");

printf("* 5xianshi 6exit * \n");

printf("* * \n");

printf("* --------------------------------------------------------- * \n");

printf(" Please input which you want(1-6):");

ch=getch();

switch(ch)

{

case '1':shuru();break;

case '2':xiugai(); break;

case '3':shanchu(); break;

case '4':chazhao(); break;

case '5':xianshi(); break;

case '6':exit(0);

default: continue;

}

}

C语言程序设计 中国铁道出版社的 课后习题答案?

一.

1.错(链表可以不是)

2.错(顺序适合查找较多的数据结构,链表适合插入删除较多的数据结构)

3.错(有可能连续)

4.错(int a[2][3]中,元素为整型)

5.对.

二.

1.B

2.C

三.

1.D

2.D

3.C(这里是要找到长度为m的链表的尾节点)

四.

1.S1语句是让p指向尾节点(因为while退出的条件是p-next,说明此时p-next为空)

2.S2语句是在链表尾插入q(p-next=q),并让q成为链表尾节点(q-next=NULL)

3.(a1,a2,a3,...an,q)

(注,这里的L是不带头节点的单链表,故第一个节点就是该元素的第一个节点)

另外,虚机团上产品团购,超级便宜

c语言程序设计中国铁道答案的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于C语言程序设计中国铁道出版社答案、c语言程序设计中国铁道答案的信息别忘了在本站进行查找喔。

扫码二维码