You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pu36jnmwt/课程设计报告_c语言程序设计在线评判系统_计算机类18...

214 lines
5.1 KiB

6 years ago
#include <stdio.h>
#include <string.h>
#include<stdlib.h>
#include<conio.h>
void add();
void change();
void find();
void ioad();
void mune();
void see();
void save();
char n[30];
int k=0;
FILE *fp;
struct tong
{ int num;
char name[30]; //<2F><><EFBFBD><EFBFBD>
char jiguan[30]; //<2F><><EFBFBD><EFBFBD>
char handset[30]; //<2F>ֻ<EFBFBD>
char handset2[30];
char email[30]; //<2F><><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>
}m[15]={0};
void load()//¼<><C2BC>
{ int i;
char s[100];
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>");
scanf("%s",s);
fp=fopen(s,"r+");
if(fp==NULL)
{
printf("open error\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>");
load();
}
else
printf("¼<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>\n");
for(i=0;i<15;i++)
{
fscanf(fp,"%d%s%s%s%s%s",&m[i].num,m[i].name,m[i].jiguan,m[i].handset,m[i].handset2,m[i].email);
}
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>ֻ<EFBFBD>1\t<EFBFBD>ֻ<EFBFBD>2\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>\n");
for(i=0;i<15;i++)
{
printf("%d\t%s\t%s\t%s\t%s\t%s\n",m[i].num,m[i].name,m[i].jiguan,m[i].handset,m[i].handset2,m[i].email);
}
printf("<EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
fflush(stdin);
getchar();
6 years ago
mune();
6 years ago
}
void find()//Ѱ<><D1B0>
{ int i;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҪѰ<EFBFBD>ҵ<EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
fflush(stdin);
scanf("%s",n);
for(i=0;i<15;i++)
{
if (strcmp(m[i].name,n)==0)
break;
}
if(i>15)
{
printf("<EFBFBD><EFBFBD><EFBFBD>޴<EFBFBD><EFBFBD><EFBFBD>\n");
fflush(stdin);
getchar();
find();
}
printf("%d\t%s\t%s\t%s\t%s\t%s\n",m[i].num,m[i].name,m[i].jiguan,m[i].handset,m[i].handset2,m[i].email);
printf("<EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
fflush(stdin);
getchar();
6 years ago
mune();
6 years ago
}
void add()//<2F><><EFBFBD><EFBFBD>
{int i;
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD>Ϣ\n\t\t/<2F><><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD>/<2F>ֻ<EFBFBD><D6BB><EFBFBD>1/<2F>ֻ<EFBFBD><D6BB><EFBFBD>2/<2F>ʼ<EFBFBD>\n");
6 years ago
scanf("%s%s%s%s%s",m[k].name,m[k].jiguan,m[k].handset,m[k].handset2,m[k].email);
k++;
m[k-1].num=k;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻس<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز˵<EFBFBD>");
scanf("%d",&i);
if(i==1)
add();
6 years ago
mune();
6 years ago
}
void change()
{
6 years ago
char c;
6 years ago
int i;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>޸<EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
scanf("%s",n);
for(i=0;i<15;i++)
{
if(strcmp(m[i].name,n)==0)
break;
}
6 years ago
if(i>=15)
6 years ago
{
printf("<EFBFBD>޴<EFBFBD><EFBFBD>ˣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
change();
6 years ago
getchar();
6 years ago
}
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>ֻ<EFBFBD>1\t<EFBFBD>ֻ<EFBFBD>2\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>\n");
printf("%d\t%s\t%s\t%s\t%s\t%s\n",m[i].num,m[i].name,m[i].jiguan,m[i].handset,m[i].handset2,m[i].email);
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ\n");
printf("\t-----------ȷ<><C8B7>Ҫ<EFBFBD>޸ĵ<DEB8><C4B5><EFBFBD>Ϣ------------\n");
printf("\t-----------<2D><><EFBFBD>ֿ<EFBFBD>1-----------\n");
printf("\t-----------<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2-----------\n");
printf("\t----------<2D><EFBFBD><E7BBB0>3----------\n");
printf("\t-----------<2D><><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>4-----------\n");
printf("\t--------------ȫ<><C8AB><EFBFBD><EFBFBD>0------------\n");
6 years ago
getchar();
scanf("%c",&c);
switch(c)
{
case '1': printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");scanf("%s",m[i].name);break;
case '2':printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");scanf("%s",m[i].jiguan);break;
case '3':printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>绰1<EFBFBD><EFBFBD>2\n");scanf("%s%s",m[i].handset,m[i].handset2);break;
case '4':printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>\n");scanf("%s",m[i].email);break;
case '0':printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>绰1<EFBFBD><EFBFBD>2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>\n");scanf("%s%s%s%s%s",m[i].name,m[i].jiguan,m[i].handset,m[i].handset2,m[i].email);break;
default:printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
}
printf("<EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ");
6 years ago
fflush(stdin);
getchar();
6 years ago
mune();
6 years ago
}
void see()
{ int i;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>ֻ<EFBFBD>1\t<EFBFBD>ֻ<EFBFBD>2\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>\n");
for(i=0;i<k;i++)
{
printf("%d\t%s\t%s\t%s\t%s\t%s\n",m[i].num,m[i].name,m[i].jiguan,m[i].handset,m[i].handset2,m[i].email);
}
printf("<EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ");
fflush(stdin);
getchar();
6 years ago
mune();
6 years ago
}
void mune()//<2F>˵<EFBFBD>
{
char c;
int i;
system("cls");
printf("\t-----------ͨѶ¼<D1B6><C2BC><EFBFBD><EFBFBD>------------\n");
printf("\t-----------<2D>ļ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>1-----------\n");
printf("\t-----------<2D><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2-----------\n");
printf("\t----------<2D><>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3----------\n");
printf("\t-----------<2D><>Ϣ<EFBFBD>޸Ŀ<DEB8>4-----------\n");
printf("\t------------<2D><><EFBFBD>ӿ<EFBFBD>5------------\n");
printf("\t----------<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6----------\n");
printf("\t--------------<2D>˳<EFBFBD><CBB3><EFBFBD>0------------\n");
fflush(stdin);
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>ֻ<EFBFBD>1\t<EFBFBD>ֻ<EFBFBD>2\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>\n");
6 years ago
for(i=0;i<k;i++)
{
printf("%d\t%s\t%s\t%s\t%s\t%s\n",m[i].num,m[i].name,m[i].jiguan,m[i].handset,m[i].handset2,m[i].email);
}
scanf("%c",&c);
switch(c)
{
case '1':system("color 2E");
load();break;
case '2':see();break;
case '3':find();break;
case '4':change();break;
6 years ago
case '5':add();break;
6 years ago
case '6':save();break;
case '0':exit(0);
default:printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD>\n");
fflush(stdin);
getchar();
}
}
int main(void)
{
int i;
system("cls");
system("color 3E");
fp=fopen("ͨѶ¼2.txt","r+");
if(fp==NULL)
{
printf("ͨѶ¼<EFBFBD>ļ<EFBFBD>¼<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>\n");
load();
}
else
printf("ͨѶ¼¼<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
k=0;
for(i=0;i<15;i++)
{
fscanf(fp,"%d%s%s%s%s%s",&m[i].num,m[i].name,m[i].jiguan,m[i].handset,m[i].handset2,m[i].email);
if((m[i].num)!=0)
k++;
}
for(i=0;i<k;i++)
{
printf("%d\t%s\t%s\t%s\t%s\t%s\n",m[i].num,m[i].name,m[i].jiguan,m[i].handset,m[i].handset2,m[i].email);
}
printf("<EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>");
fflush(stdin);
getchar();
mune();
}
void save()
{
int i;
rewind(fp);
for(i=0;i<k;i++)
fprintf(fp,"\n%d\t%s\t%s\t%s\t%s\t%s",m[i].num,m[i].name,m[i].jiguan,m[i].handset,m[i].handset2,m[i].email);
6 years ago
mune();
6 years ago
}