|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<windows.h>
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
#include<conio.h>
|
|
|
|
|
#define MAX_NOTE 150//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>150
|
|
|
|
|
FILE *fp;
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
int sno;//<2F><><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>
|
|
|
|
|
int p1;//<2F><>Ʒ1<C6B7><31>
|
|
|
|
|
int p2;//<2F><>Ʒ2<C6B7><32>
|
|
|
|
|
int p3;//<2F><>Ʒ3<C6B7><33>
|
|
|
|
|
int p4;//<2F><>Ʒ4<C6B7><34>
|
|
|
|
|
int p5;//<2F><>Ʒ5<C6B7><35>
|
|
|
|
|
}SELL;
|
|
|
|
|
SELL s[MAX_NOTE];
|
|
|
|
|
void add_note();
|
|
|
|
|
void menu();
|
|
|
|
|
void visit_sale();
|
|
|
|
|
void sale_sort();
|
|
|
|
|
void sale_data();
|
|
|
|
|
void pro_sort();
|
|
|
|
|
void clear_all();
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
menu();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
void menu()//<2F><><EFBFBD>˵<EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
system("cls");
|
|
|
|
|
system("color 0B");
|
|
|
|
|
int choice;
|
|
|
|
|
printf("\n\n\n\n\t\t\t\t");
|
|
|
|
|
printf("-*-*-*-*<2A><>ӭ<EFBFBD><D3AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۹<EFBFBD><DBB9><EFBFBD>ϵͳ-*-*-*-*-\n");
|
|
|
|
|
printf("\t\t\t\t|1.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ¼<CFA2><C2BC>\n");
|
|
|
|
|
printf("\t\t\t\t|2.<2E>鿴<EFBFBD><E9BFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("\t\t\t\t|3.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("\t\t\t\t|4.<2E>˳<EFBFBD>ϵͳ\n");
|
|
|
|
|
printf("\n\n\n\n\t\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1-3<><33><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%d",&choice);
|
|
|
|
|
switch(choice)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
add_note();//¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
visit_sale();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
clear_all();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
exit(0);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룺");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
menu();
|
|
|
|
|
getchar();
|
|
|
|
|
}
|
|
|
|
|
void clear_all()
|
|
|
|
|
{
|
|
|
|
|
system("cls");
|
|
|
|
|
fp=fopen("note.dat","wb+");
|
|
|
|
|
fclose(fp);
|
|
|
|
|
printf("\n\n\n\n\t\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
system("pause");
|
|
|
|
|
menu();
|
|
|
|
|
}
|
|
|
|
|
void add_note()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ¼<CFA2><C2BC>
|
|
|
|
|
{
|
|
|
|
|
system("cls");
|
|
|
|
|
int i,n,k=1;
|
|
|
|
|
//SELL s[MAX_NOTE];
|
|
|
|
|
fp=fopen("note.dat","rb+");
|
|
|
|
|
if(fp==NULL)
|
|
|
|
|
{
|
|
|
|
|
fp=fopen("note.dat","wb+");
|
|
|
|
|
if(fp==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("file open fail!\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fseek(fp,0,SEEK_END);
|
|
|
|
|
printf("\n\n\n\n\t\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ӵı<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t\t\t-*-*-*-*-*-*-*-\n");
|
|
|
|
|
printf("\t\t\t\t-----<2D><><EFBFBD><EFBFBD>%d------",k++);
|
|
|
|
|
printf("\n\t\t\t\t|<7C><><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD>ţ<EFBFBD>");
|
|
|
|
|
scanf("%d",&s[i].sno);
|
|
|
|
|
printf("\n\t\t\t\t| **<2A><>Ʒ1<C6B7>ţ<EFBFBD>");
|
|
|
|
|
scanf("%d",&s[i].p1);
|
|
|
|
|
printf("\n\t\t\t\t| **<2A><>Ʒ2<C6B7>ţ<EFBFBD>");
|
|
|
|
|
scanf("%d",&s[i].p2);
|
|
|
|
|
printf("\n\t\t\t\t| **<2A><>Ʒ3<C6B7>ţ<EFBFBD>");
|
|
|
|
|
scanf("%d",&s[i].p3);
|
|
|
|
|
printf("\n\t\t\t\t| **<2A><>Ʒ4<C6B7>ţ<EFBFBD>");
|
|
|
|
|
scanf("%d",&s[i].p4);
|
|
|
|
|
printf("\n\t\t\t\t| **<2A><>Ʒ5<C6B7>ţ<EFBFBD>");
|
|
|
|
|
scanf("%d",&s[i].p5);
|
|
|
|
|
printf("\n\t\t\t\t-*-*-*-*-*-*-*-\n");
|
|
|
|
|
fwrite(&s[i],sizeof(SELL),1,fp);
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
printf("\t\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>¼<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>...");
|
|
|
|
|
sleep(3);
|
|
|
|
|
menu();
|
|
|
|
|
}
|
|
|
|
|
void visit_sale()
|
|
|
|
|
{
|
|
|
|
|
system("cls");
|
|
|
|
|
int choice;
|
|
|
|
|
printf("\n\n\n\t\t\t\t----<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>鿴----");
|
|
|
|
|
printf("\n\t\t\t\t1.<2E>鿴<EFBFBD><E9BFB4><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD>۶<EFBFBD>");
|
|
|
|
|
printf("\n\t\t\t\t2.<2E><><EFBFBD><EFBFBD>Աҵ<D4B1><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
printf("\n\t\t\t\t3.<2E><>Ʒ<EFBFBD>ܻ<EFBFBD>ӭ<EFBFBD><D3AD><EFBFBD><EFBFBD>");
|
|
|
|
|
printf("\n\t\t\t\t4.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
printf("\n\t\t\t\t5.<2E>˳<EFBFBD>ϵͳ");
|
|
|
|
|
printf("\n\n\n\t\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1-5<><35>:");
|
|
|
|
|
scanf("%d",&choice);
|
|
|
|
|
getchar();
|
|
|
|
|
switch(choice)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
sale_data();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
sale_sort();
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
pro_sort();
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
menu();
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
exit(1);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>...");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
visit_sale();
|
|
|
|
|
getchar();
|
|
|
|
|
}
|
|
|
|
|
void sale_data()
|
|
|
|
|
{
|
|
|
|
|
system("cls");
|
|
|
|
|
int i,k,ch;
|
|
|
|
|
int v1,v2,v3,v4,v5;
|
|
|
|
|
v1=v2=v3=v4=v5=0;
|
|
|
|
|
fp=fopen("note.dat","rb+");
|
|
|
|
|
if(fp==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("\n\n\n\t\t\t\tfile open fail!");
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
rewind(fp);
|
|
|
|
|
printf("\n\n\n\t\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(1-4):");
|
|
|
|
|
scanf("%d",&k);
|
|
|
|
|
fread(&s,sizeof(SELL),1,fp);
|
|
|
|
|
for(i=0;i<MAX_NOTE;i++)
|
|
|
|
|
{
|
|
|
|
|
fread(&s[i],sizeof(SELL),1,fp);
|
|
|
|
|
if(s[i].sno==k)
|
|
|
|
|
{
|
|
|
|
|
v1+=s[i].p1;
|
|
|
|
|
v2+=s[i].p2;
|
|
|
|
|
v3+=s[i].p3;
|
|
|
|
|
v4+=s[i].p4;
|
|
|
|
|
v5+=s[i].p5;
|
|
|
|
|
fread(&s[i],sizeof(SELL),1,fp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n\t\t\t\t<EFBFBD><EFBFBD>Ʒ1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ%d",v1);
|
|
|
|
|
printf("\n\t\t\t\t<EFBFBD><EFBFBD>Ʒ2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ%d",v2);
|
|
|
|
|
printf("\n\t\t\t\t<EFBFBD><EFBFBD>Ʒ3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ%d",v3);
|
|
|
|
|
printf("\n\t\t\t\t<EFBFBD><EFBFBD>Ʒ4<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ%d",v4);
|
|
|
|
|
printf("\n\t\t\t\t<EFBFBD><EFBFBD>Ʒ5<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܶ%d",v5);
|
|
|
|
|
printf("\n\n\n\t\t\t\t<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>:");
|
|
|
|
|
scanf("%d",&ch);
|
|
|
|
|
if(ch==0)
|
|
|
|
|
visit_sale();
|
|
|
|
|
else
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
void sale_sort()
|
|
|
|
|
{
|
|
|
|
|
system("cls");
|
|
|
|
|
int i,j,t,ch,g=1;
|
|
|
|
|
int sum[4],b[4]={1,2,3,4};
|
|
|
|
|
int s1,s2,s3,s4;
|
|
|
|
|
s1=s2=s3=s4=0;
|
|
|
|
|
fp=fopen("note.dat","rb+");
|
|
|
|
|
if(fp==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("file open fail!\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
fread(&s,sizeof(SELL),1,fp);
|
|
|
|
|
for(i=0;i<MAX_NOTE;i++)
|
|
|
|
|
{
|
|
|
|
|
fread(&s[i],sizeof(SELL),1,fp);
|
|
|
|
|
if(s[i].sno==1)
|
|
|
|
|
s1+=(s[i].p1+s[i].p2+s[i].p3+s[i].p4+s[i].p5);
|
|
|
|
|
if(s[i].sno==2)
|
|
|
|
|
s2+=(s[i].p1+s[i].p2+s[i].p3+s[i].p4+s[i].p5);
|
|
|
|
|
if(s[i].sno==3)
|
|
|
|
|
s3+=(s[i].p1+s[i].p2+s[i].p3+s[i].p4+s[i].p5);
|
|
|
|
|
if(s[i].sno==4)
|
|
|
|
|
s4+=(s[i].p1+s[i].p2+s[i].p3+s[i].p4+s[i].p5);
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
sum[0]=s1;sum[1]=s2;sum[2]=s3;sum[3]=s4;
|
|
|
|
|
for(i=0;i<4;i++)
|
|
|
|
|
{
|
|
|
|
|
for(j=i+1;j<4;j++)
|
|
|
|
|
{
|
|
|
|
|
if(sum[i]<sum[j])
|
|
|
|
|
{
|
|
|
|
|
t=sum[j];
|
|
|
|
|
sum[j]=sum[i];
|
|
|
|
|
sum[i]=t;
|
|
|
|
|
t=b[j];
|
|
|
|
|
b[j]=b[i];
|
|
|
|
|
b[i]=t;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n\n\n\t\t\t\t-----<2D><><EFBFBD><EFBFBD>Աҵ<D4B1><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-----\n");
|
|
|
|
|
printf("\t\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD>\n");
|
|
|
|
|
for(i=0;i<4;i++)
|
|
|
|
|
printf("\t\t\t\t%-10d%-10d%-15d\n",g++,b[i],sum[i]);
|
|
|
|
|
printf("\n\n\n\t\t\t\t<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>:");
|
|
|
|
|
scanf("%d",&ch);
|
|
|
|
|
if(ch==0)
|
|
|
|
|
visit_sale();
|
|
|
|
|
else
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
void pro_sort()
|
|
|
|
|
{
|
|
|
|
|
system("cls");
|
|
|
|
|
int g=1;
|
|
|
|
|
int s1,s2,s3,s4,s5,ch;
|
|
|
|
|
int i,j,t,sum[5],b[5]={1,2,3,4,5};
|
|
|
|
|
s1=s2=s3=s4=s5=0;
|
|
|
|
|
fp=fopen("note.dat","rb+");
|
|
|
|
|
if(fp==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("file open fail!\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
fread(&s,sizeof(SELL),1,fp);
|
|
|
|
|
for(i=0;i<MAX_NOTE;i++)
|
|
|
|
|
{
|
|
|
|
|
fread(&s[i],sizeof(SELL),1,fp);
|
|
|
|
|
s1+=s[i].p1;
|
|
|
|
|
s2+=s[i].p2;
|
|
|
|
|
s3+=s[i].p3;
|
|
|
|
|
s4+=s[i].p4;
|
|
|
|
|
s5+=s[i].p5;
|
|
|
|
|
}
|
|
|
|
|
sum[0]=s1;sum[1]=s2;sum[2]=s3;sum[3]=s4;sum[4]=s5;
|
|
|
|
|
for(i=0;i<5;i++)
|
|
|
|
|
{
|
|
|
|
|
for(j=i+1;j<5;j++)
|
|
|
|
|
{
|
|
|
|
|
if(sum[i]<sum[j])
|
|
|
|
|
{
|
|
|
|
|
t=sum[j];
|
|
|
|
|
sum[j]=sum[i];
|
|
|
|
|
sum[i]=t;
|
|
|
|
|
t=b[j];
|
|
|
|
|
b[j]=b[i];
|
|
|
|
|
b[i]=t;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n\n\n\t\t\t\t-----<2D><>Ʒ<EFBFBD><C6B7><EFBFBD>۶<EFBFBD><DBB6><EFBFBD><EFBFBD><EFBFBD>-----\n");
|
|
|
|
|
printf("\t\t\t\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD>\n");
|
|
|
|
|
for(i=0;i<5;i++)
|
|
|
|
|
printf("\t\t\t\t%-10d%-10d%-15d\n",g++,b[i],sum[i]);
|
|
|
|
|
printf("\n\n\n\t\t\t\t<EFBFBD><EFBFBD>0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>:");
|
|
|
|
|
scanf("%d",&ch);
|
|
|
|
|
if(ch==0)
|
|
|
|
|
visit_sale();
|
|
|
|
|
else
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|