应用c语言编写程序

应用c语言编写程序,第1张

c语言编译程序属于系统软件。

编译程序(Compiler,compilingprogram)也称为编译器,是指把用高级程序设计语言书写的源程序,翻译成等价的机器语言格式目标程序的翻译程序。

这里的编译程序是一种动作,是根据编译原理技术,由高级程序设计语言编译器翻译成机器语言二进制代码行为,因此它是系统软件。

扩展资料:

应用软件:是和系统软件相对应的,是用户可以使用的各种程序设计语言,以及用各种程序设计语言编制的应用程序的集合,分为应用软件包和用户程序。应用软件包是利用计算机解决某类问版题而设计的程序的集合,供多用户使用。比如浏览器、权百度云管家等等都是应用软件。

工具软件:是指在使用电脑进行工作和学习时经常使用的软件,比如电脑管家等杀毒软件,一般工具软件都属于应用软件。

同学你参照下,有不懂的,百度上Hi我

#include<stdioh>

#include<stdlibh>

#include<malloch>

#include<stringh>

struct sc

{

int chinese;

int maths;

int english;

};

typedef struct node

{

int num;

char name[20];

struct sc score;

struct node next;

}st;

int menu()//菜单

{

int choice;

do{

system("cls");

printf("\t1input the messega about a student\n");

printf("\t2insect a messega of a new student\n");

printf("\t3look for the messega\n");

printf("\t4dellect the messega\n");

printf("\t5arranging base on the number of learning\n");

printf("\t6output all the messega\n");

printf("\t7arranging base on all scores\n");

printf("\t8exit the system\n");

printf("\tplease input your choice:");

scanf("%d",&choice);

}while(choice>7&&choice<1);

return choice;

}

st create()//创建链表

{

st head,p,tail;

char c;

head=tail=NULL;

while(c!='n'&&c!='N')

{

p=(st )malloc(sizeof(st));

p->next=NULL;

printf("\t\tplease input the number of learning:");

scanf("%d",&p->num);

printf("\t\tplease input the name:");

scanf("%s",p->name);

printf("\t\tplease input the score of chinese:");

scanf("%d",&p->scorechinese);

printf("\t\tplease input the score of maths:");

scanf("%d",&p->scoremaths);

printf("\t\tplease input the score of english:");

scanf("%d",&p->scoreenglish);

if(head==NULL)

head=tail=p;

else

{

tail->next=p;

tail=p;

}

printf("\t\tcontinue or stop(Y/N):");

scanf("%s",&c);

}

return head;

}

st arrange(st head)// 以学号排名

{

st p,q;

int t,i=1,j,chinese,maths,english;

char name[20];

p=head;

if(head==NULL)

printf("\t\tNoting to arrange\n");

else

{

do

{

j=1;

while(p->next!=NULL)

{

q=p->next;

if(p->num>=q->num)

{

t=p->num;

p->num=q->num;

q->num=t;

strcpy(name,p->name);

strcpy(p->name,q->name);

strcpy(q->name,name);

chinese=p->scorechinese;

p->scorechinese=q->scorechinese;

q->scorechinese=chinese;

maths=p->scoremaths;

p->scoremaths=q->scoremaths;

q->scoremaths=maths;

english=p->scoreenglish;

p->scoreenglish=q->scoreenglish;

q->scoreenglish=english;

}

p=q;

j++;

}

p=head;

i++;

}while(i!=j);

}

return head;

}

st arrangeall(st head)//以总分排名

{

st p,q;

int t,i=1,j,chinese,maths,english;

char name[20];

p=head;

if(head==NULL)

printf("\t\tNoting to arrange\n");

else

{

do

{

j=1;

while(p->next!=NULL)

{

q=p->next;

if(p->scorechinese+p->scoremaths+p->scoreenglish<q->scorechinese+q->scoremaths+q->scoreenglish)

{

t=p->num;

p->num=q->num;

q->num=t;

strcpy(name,p->name);

strcpy(p->name,q->name);

strcpy(q->name,name);

chinese=p->scorechinese;

p->scorechinese=q->scorechinese;

q->scorechinese=chinese;

maths=p->scoremaths;

p->scoremaths=q->scoremaths;

q->scoremaths=maths;

english=p->scoreenglish;

p->scoreenglish=q->scoreenglish;

q->scoreenglish=english;

}

p=q;

j++;

}

p=head;

i++;

}while(i!=j);

}

return head;

}

st insect(st head,st t)//插入学生的信息

{

st p,q;

p=head;

if(head==NULL)

printf("\tThe list is empty\n");

else

{

if(t->num==p->num)

{

head=t;

t->next=p;

}

else

{

while(p->next!=NULL)

{

q=p->next;

if(p->num<=t->num&&q->num>=t->num)

{

t->next=q;

p->next=t;

}

p=q;

}

p->next=t;

}

}

return head;

}

void output(st head)//输出所以学生的信息

{

st p;

int i=0;

float sum1=0,sum2=0,sum3=0;

p=head;

if(head==NULL)

{

printf("\tThere is nothing \n");

return;

}

else

{

printf("\tnumber name chinese maths english allscores\n");

while(p)

{

printf("\t %d ",p->num);

printf(" %s ",p->name);

printf(" %d ",p->scorechinese);

printf(" %d ",p->scoremaths);

printf(" %d ",p->scoreenglish);

printf("%6d",p->scorechinese+p->scoremaths+p->scoreenglish);

printf("\n");

p=p->next;

}

p=head;

while(p)// avrege scores

{

sum1+= p->scorechinese;

sum2+=p->scoremaths;

sum3+=p->scoreenglish;

p=p->next;

i++;

}

printf("\tarvege %2f %2f %2f %2f \n",sum1/i,sum2/i,sum3/i,(sum1+sum2+sum3)/i);

}

system("pause");

}

st dellect(st head,st d)//删除学生的信息

{

st p,q;

char c;

p=head;

if(!(strcmp(p->name,d->name)))

{

head=p->next;

free(p);

}

else

{

while((strcmp(p->name,d->name))&&p->next!=NULL)

{

q=p;

p=q->next;

}

if(!(strcmp(p->name,d->name)))

{

printf("do you want to delete %S (Y/N):",p->name);

scanf("%s",&c);

if(c=='y'||c=='Y')

{

q->next=p->next;

free(p);

}

}

else

printf("\tThere isn't this name\n");

}

return head;

}

void find(st head,st s)//查找学生的信息

{

st p,q;

p=head;

if(head==NULL)

printf("\tThe list is empty\n");

else

{

while((strcmp(p->name,s->name))!=0&&p->next!=NULL)

{

q=p;

p=q->next;

}

if((strcmp(p->name,s->name))==0)

{

printf("\t %d ",p->num);

printf(" %s ",p->name);

printf(" chinese=%d ",p->scorechinese);

printf(" maths=%d ",p->scoremaths);

printf(" english=%d ",p->scoreenglish);

printf("all=%d",p->scorechinese+p->scoremaths+p->scoreenglish);

printf("\n");

}

else

printf("\tThe name is missing\n");

}

system("pause");

}

void main()//主函数

{

st head,t,s,d;

int choice;

for(;;)

{

choice=menu();

switch(choice)

{

case 1:

head=create();

break;

case 2:

t=(st )malloc(sizeof(st));

t->next=NULL;

printf("\t\tplease input the number of learning:");

scanf("%d",&t->num);

printf("\t\tplease input the name:");

scanf("%s",t->name);

printf("\t\tplease input the score of chinese:");

scanf("%d",&t->scorechinese);

printf("\t\tplease input the score of maths:");

scanf("%d",&t->scoremaths);

printf("\t\tplease input the score of english:");

scanf("%d",&t->scoreenglish);

head=insect(head,t);

break;

case 4:

d=(st )malloc(sizeof(st));

d->next=NULL;

printf("\twhice student do you want to dellectplease input the name:");

scanf("%s",d->name);

head=dellect(head,d);

break;

case 3:

s=(st )malloc(sizeof(st));

s->next=NULL;

printf("\twhice student do you want to look forplease input the name:");

scanf("%s",s->name);

find(head,s);

break;

case 5:

head=arrange(head);//number

break;

case 6:

output(head);

break;

case 7:

head=arrangeall(head);//score

break;

case 8:

printf("\t\tThank you,goodbye\n");

exit(0);

}

}

}

#include <stdioh>

#include <stdlibh>

#include <timeh>

#define N 10

void sort(int arr[], int n);

int main()

{

int arr[N];

int i;

srand((unsigned int)time(NULL)); // 设置随机数种子

// 随机生成10个1到100的正整数

for (i = 0; i < N; i++) {

arr[i] = rand() % 100 + 1;

}

printf("排序前:");

for (i = 0; i < N; i++) {

printf("%d ", arr[i]);

}

printf("\n");

sort(arr, N); // 排序

printf("排序后:");

for (i = 0; i < N; i++) {

printf("%d ", arr[i]);

}

printf("\n");

return 0;

}

void sort(int arr[], int n)

{

int i, j, temp;

for (i = 0; i < n - 1; i++) {

for (j = 0; j < n - 1 - i; j++) {

if (arr[j] < arr[j+1]) { // 如果前一个元素比后一个元素小,交换位置

temp = arr[j];

arr[j] = arr[j+1];

arr[j+1] = temp;

}

}

}

}

以上就是关于应用c语言编写程序全部的内容,包括:应用c语言编写程序、c语言学生成绩管理系统程序设计,有添加,查找,删除,输出,修改,排序等功能!!!、c语言程序设计这道题,求求等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zz/10097698.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-05
下一篇2023-05-05

发表评论

登录后才能评论

评论列表(0条)

    保存