1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > c语言大作业旋转 c语言大作业全-0412035629.docx-原创力文档

c语言大作业旋转 c语言大作业全-0412035629.docx-原创力文档

时间:2018-05-29 03:23:00

相关推荐

c语言大作业旋转 c语言大作业全-0412035629.docx-原创力文档

Document number:PBGCG-0857-BTDO-0089-PTT1998

Document number:PBGCG-0857-BTDO-0089-PTT1998

C语言大作业全

#include ""

#include ""

#include ""

#include ""

#include ""

#define LEN sizeof(struct student)

#define NULL 0

int n,m;

int k=1;

struct student

{char num[20];

char name[20];

int age;

char profession[50];

int maths;

int english;

int C_program;

float ave;

struct student * next;

};

float ave(struct student * p1)

{

float ave;

ave=(float)(p1->maths+p1->english+p1->C_program)/3;

return ave;

}

void save(struct student *head)

{

struct student *p1 = head;

FILE *outFile;

outFile = fopen("", "wb");

if (outFile == NULL) {

printf("\nFile error.");

}

else {

while(p1 != NULL)

{

fwrite(p1, sizeof(struct student), 1, outFile);

p1 = p1->next;

}

fclose(outFile);

}

}

;

}

else {

head = (struct student *)malloc(sizeof(struct student));

fread(head, sizeof(*head), 1, infile);

p2 = head;

while(fread(&record, sizeof(record), 1, infile));

}

fwrite(p1, sizeof(struct student), 1, outFile);

fclose(outFile);

}

void sta(struct student * head,char array[20],int max,int min)

{

struct student *p1=head;

int k=0;

if(strcmp(array,"maths")==0)

{

while(p1!=NULL)

{

if(p1->maths>=min&&p1->maths<=max)

k++;

p1=p1->next;

}

printf("数学科目在%d到%d之间的人数为:%d\n",min,max,k);

}

else if(strcmp(array,"english")==0)

{

while(p1!=NULL)

{

if(p1->english>=min&&p1->english<=max)

k++;

p1=p1->next;

}

printf("英语科目在%d到%d之间的人数为:%d\n",min,max,k);

}

else if(strcmp(array,"C_program")==0)

{

while(p1!=NULL)

{

if(p1->C_program>=min&&p1->C_program<=max)

k++;

p1=p1->next;

}

printf("C语言科目在%d到%d之间的人数为:%d\n",min,max,k);

}

}

void exit()

{

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

printf("\t\t");printf("*******感谢使用*******\n");

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

k=0;

}

void Chooseproject(int i)

{ struct student *

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。