求 c#语言编写一个学生成绩管理系统
1.用c#语言编写一个学生成绩管理系统,要求可以实现简单的录入,查询,可以求出平均成绩(可以使用控制台程序也可以使用windows应用程序)...
1.用c#语言编写一个学生成绩管理系统,要求可以实现简单的录入,查询,可以求出平均成绩(可以使用控制台程序也可以使用windows应用程序)
展开
3个回答
展开全部
#include"stdio.h"
#include"string.h"
#include"malloc.h"
#include"conio.h"
#include"stdlib.h"
#define N 3
typedef struct student{
long num;
char name[20];
int score[4];
struct student* next;
}Student;
char menu();
void input(Student*);
void delete(Student*);
Student* search(Student*,long);
void reexamine(Student*);
void display(Student*);
void dispnode(Student*);
void caidan();
char course[4][20]={{''},{'m','a','t','h'},{'e','n','g','l','i','s','h'},{'c','o','m','p','u','t','e','r'}};
Student* head;
Student* p;
void main()
{
long num;
int i;
clrscr();
printf("\nEnter %d course names:\n",N);
fflush(stdin);
p=(Student*)malloc(sizeof(Student));
if (p==NULL)
{printf("\nMemory allocation error.");
exit(1);
}
else
{
p->num=0;
p->next=NULL;
strcpy(p->name,"head node");
for(i=0;i<N;i++)
p->score[i]=0;
head=p;
caidan();
}
}
char menu()
{
char ch;
int i;
clrscr();
printf("\n\n\t1 --- -Input\n");
printf("\n\t2 --- Display\n");
printf("\n\t3 --- delete\n");
printf("\n\t4 --- Search\n");
printf("\n\t5 --- Reexamine\n");
printf("\n\t6 --- Exit\n");
printf("\n\n\t\t Enter your choice:");
fflush(stdin);
ch=getchar() ;
getchar();
return ch;
}
void input(Student* h)
{
long num;
Student *p,*q,*r;
int i,n=0;
char ch;
clrscr();
printf("\nEnter data for a student:\n");
printf("\nnum:");
scanf("%ld",&num);
while(num<3)
{
p=search(h,num);
if
(p!=NULL)
{
printf("\n%ld num student has been existed.",num);
printf("\nReenter num for a student,please:");
fflush(stdin);
scanf("%ld",&num);
}
else
{
p=(Student*)malloc(sizeof(Student));
if(p==NULL)
{
printf("\nMemory allocation error.");
exit(0);
}
else
{
n++;
p->num=num;
printf("\nName:");
fflush(stdin);
gets(p->name);
printf("\nEnter %d examine scores:",N);
for(i=1;i<=N;i++)
{
printf("\n%s:\t",course[i]);
scanf("%d",&p->score[i]);
}
}
r=h;
q=r->next;
while(q!=NULL && num>q->num)
{
r=q;
q=q->next;
}
r->next=p;
p->next=q;
clrscr();
printf("\nEnter data for a student:\n");
printf("\nnum:");
scanf("%ld",&num);
}
}
h->num=n;
printf("\n There are(is) %d student(s) were(was) inserted.",n);
printf("\n There are(is) total %ld student(s).",h->num);
printf("press any key back to main menu!");
getchar();
caidan();
}
Student* search(Student* h,long num)
{
Student *p,*q;
q=h;
p=h->next;
if (p==NULL)
return NULL;
else
{
while(p!=NULL && p->num!=num)
{
q=p;
p=p->next;
}
if(p!=NULL && p->num==num)
return(q);
else
return NULL;
}
}
void reexamine(Student* h)
{
Student *p;
int pass;
int i=0;
int nopass=0;
clrscr();
if(h->num==0)
printf("\nThere is no student in the list.");
else
{
p=h->next;
while(p!=NULL)
{
pass=1;
for (i=0;i<N;i++)
{
if(p->score[i]<60)
{pass=0;
nopass++;
break;
}
}
if (pass==0)
{
dispnode(p);
printf("\nEnter any key to continue,please:");
getchar();
}
p=p->next;
}
printf("\n\nThere %s total %ld student(s)",h->num,"are:",h->num);
printf("\nincluded %d student%c no-pass.",nopass);
printf("\nNo-pass percentage is%.2f%%.\n",(float)(nopass)/h->num *100);
}
}
void display(Student*h)
{Student*p;
int many;
clrscr();
if (h->num==0)
printf("\nThere is no student in the list.\n");
else
{p=h->next;
while(p!=NULL)
{
dispnode(p);
printf("\nEnter any to continue,please:");
getchar();
p=p->next;
};
}
{
many=h->num>1;
printf("There%s %1dstudent()s",many?"are":"is",h->num);
}
}
void delete(Student *h)
{Student *p,*q;
int num;
char answer;
clrscr();
printf("\nEnter num of the student being deleted:");
scanf("%ld",&num);
q=search(h,num);
if(q!=NULL)
{
p=q->next;
dispnode(p);
printf("\nDelete the student,are you sure? (Y/N):");
fflush(stdin);
answer=getchar();
answer=tolower(answer);
if (answer=='y')
{
q->next=p->next;
free(p);
h->num--;
}
else
{
printf("\n You change your idea,bye_bye.");
}
}
else
{
printf("\nThe student to be delete is not found.");
}
caidan();
}
void dispnode(Student* h)
{
printf("number name score[1] score[2] score[3]\n");
printf("%ld %s %d %d %d\n",h->num,h->name,h->score[1],h->score[2],h->score[3]);
}
void caidan()
{
int num;
char ch;
do{
ch=menu();
switch(ch)
{case '1':input(head);
break;
case '2':display(head);
caidan();
break;
case '3':delete(head);
break;
case '4':clrscr();printf("\nEnter the number of student:");
scanf("%d",&num);
p=search(head,num);
if (p==NULL)
printf("\n%ld num student is not found.",num);
else
dispnode(p->next);
printf("\nEnter any key to continue,please:");
getchar();
getchar();
caidan();
break;
case '5':reexamine(head);
printf("\nEnter any key to continue,please:");
getchar();
caidan();
break;
case '6':printf("\nExit the program now,bye_bye!");
exit(0);
break;
default:printf("\nYou should press <1> --<6>");
if(ch=='\n' || ch=='\t' ||ch=='')
printf("\nch is thite character.\n");
else
printf("\nch=%c\n",&ch);
break;
}
}while(ch=='6');
}
#include"string.h"
#include"malloc.h"
#include"conio.h"
#include"stdlib.h"
#define N 3
typedef struct student{
long num;
char name[20];
int score[4];
struct student* next;
}Student;
char menu();
void input(Student*);
void delete(Student*);
Student* search(Student*,long);
void reexamine(Student*);
void display(Student*);
void dispnode(Student*);
void caidan();
char course[4][20]={{''},{'m','a','t','h'},{'e','n','g','l','i','s','h'},{'c','o','m','p','u','t','e','r'}};
Student* head;
Student* p;
void main()
{
long num;
int i;
clrscr();
printf("\nEnter %d course names:\n",N);
fflush(stdin);
p=(Student*)malloc(sizeof(Student));
if (p==NULL)
{printf("\nMemory allocation error.");
exit(1);
}
else
{
p->num=0;
p->next=NULL;
strcpy(p->name,"head node");
for(i=0;i<N;i++)
p->score[i]=0;
head=p;
caidan();
}
}
char menu()
{
char ch;
int i;
clrscr();
printf("\n\n\t1 --- -Input\n");
printf("\n\t2 --- Display\n");
printf("\n\t3 --- delete\n");
printf("\n\t4 --- Search\n");
printf("\n\t5 --- Reexamine\n");
printf("\n\t6 --- Exit\n");
printf("\n\n\t\t Enter your choice:");
fflush(stdin);
ch=getchar() ;
getchar();
return ch;
}
void input(Student* h)
{
long num;
Student *p,*q,*r;
int i,n=0;
char ch;
clrscr();
printf("\nEnter data for a student:\n");
printf("\nnum:");
scanf("%ld",&num);
while(num<3)
{
p=search(h,num);
if
(p!=NULL)
{
printf("\n%ld num student has been existed.",num);
printf("\nReenter num for a student,please:");
fflush(stdin);
scanf("%ld",&num);
}
else
{
p=(Student*)malloc(sizeof(Student));
if(p==NULL)
{
printf("\nMemory allocation error.");
exit(0);
}
else
{
n++;
p->num=num;
printf("\nName:");
fflush(stdin);
gets(p->name);
printf("\nEnter %d examine scores:",N);
for(i=1;i<=N;i++)
{
printf("\n%s:\t",course[i]);
scanf("%d",&p->score[i]);
}
}
r=h;
q=r->next;
while(q!=NULL && num>q->num)
{
r=q;
q=q->next;
}
r->next=p;
p->next=q;
clrscr();
printf("\nEnter data for a student:\n");
printf("\nnum:");
scanf("%ld",&num);
}
}
h->num=n;
printf("\n There are(is) %d student(s) were(was) inserted.",n);
printf("\n There are(is) total %ld student(s).",h->num);
printf("press any key back to main menu!");
getchar();
caidan();
}
Student* search(Student* h,long num)
{
Student *p,*q;
q=h;
p=h->next;
if (p==NULL)
return NULL;
else
{
while(p!=NULL && p->num!=num)
{
q=p;
p=p->next;
}
if(p!=NULL && p->num==num)
return(q);
else
return NULL;
}
}
void reexamine(Student* h)
{
Student *p;
int pass;
int i=0;
int nopass=0;
clrscr();
if(h->num==0)
printf("\nThere is no student in the list.");
else
{
p=h->next;
while(p!=NULL)
{
pass=1;
for (i=0;i<N;i++)
{
if(p->score[i]<60)
{pass=0;
nopass++;
break;
}
}
if (pass==0)
{
dispnode(p);
printf("\nEnter any key to continue,please:");
getchar();
}
p=p->next;
}
printf("\n\nThere %s total %ld student(s)",h->num,"are:",h->num);
printf("\nincluded %d student%c no-pass.",nopass);
printf("\nNo-pass percentage is%.2f%%.\n",(float)(nopass)/h->num *100);
}
}
void display(Student*h)
{Student*p;
int many;
clrscr();
if (h->num==0)
printf("\nThere is no student in the list.\n");
else
{p=h->next;
while(p!=NULL)
{
dispnode(p);
printf("\nEnter any to continue,please:");
getchar();
p=p->next;
};
}
{
many=h->num>1;
printf("There%s %1dstudent()s",many?"are":"is",h->num);
}
}
void delete(Student *h)
{Student *p,*q;
int num;
char answer;
clrscr();
printf("\nEnter num of the student being deleted:");
scanf("%ld",&num);
q=search(h,num);
if(q!=NULL)
{
p=q->next;
dispnode(p);
printf("\nDelete the student,are you sure? (Y/N):");
fflush(stdin);
answer=getchar();
answer=tolower(answer);
if (answer=='y')
{
q->next=p->next;
free(p);
h->num--;
}
else
{
printf("\n You change your idea,bye_bye.");
}
}
else
{
printf("\nThe student to be delete is not found.");
}
caidan();
}
void dispnode(Student* h)
{
printf("number name score[1] score[2] score[3]\n");
printf("%ld %s %d %d %d\n",h->num,h->name,h->score[1],h->score[2],h->score[3]);
}
void caidan()
{
int num;
char ch;
do{
ch=menu();
switch(ch)
{case '1':input(head);
break;
case '2':display(head);
caidan();
break;
case '3':delete(head);
break;
case '4':clrscr();printf("\nEnter the number of student:");
scanf("%d",&num);
p=search(head,num);
if (p==NULL)
printf("\n%ld num student is not found.",num);
else
dispnode(p->next);
printf("\nEnter any key to continue,please:");
getchar();
getchar();
caidan();
break;
case '5':reexamine(head);
printf("\nEnter any key to continue,please:");
getchar();
caidan();
break;
case '6':printf("\nExit the program now,bye_bye!");
exit(0);
break;
default:printf("\nYou should press <1> --<6>");
if(ch=='\n' || ch=='\t' ||ch=='')
printf("\nch is thite character.\n");
else
printf("\nch=%c\n",&ch);
break;
}
}while(ch=='6');
}
展开全部
我手头有个类似的
可以看下
窗体的sql数据库的程序
1635398886
演示地址
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
c#语言编写一个学生成绩管理系统
还有有不少是现成的,
需要的话可以
采纳哦!
还有有不少是现成的,
需要的话可以
采纳哦!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询