① 電影院售票的求大蝦們幫我做一個電影院售票系統(C#,java都行)CS或者BS結構都行 ,很急 請大蝦們幫幫忙
這是我以前寫的
#include<stdio.h>
#include<string.h>
#defineN99//票數容量
structDate
{
intyear;
intmonth;
intday;
};
structWord
{
charmovie[20];//片名
structDatetime;//上映日期
intprice;//票價
intspare;//剩餘票數
}a[N],t;
voidnewticket(FILE*fp)
{
printf("片名:");
scanf("%s",t.movie);
printf("日期:(例如2014125) ");
scanf("%d%d%d",&t.time.year,&t.time.month,&t.time.day);
printf("票價:");
scanf("%d",&t.price);
printf("剩餘票數:");
scanf("%d",&t.spare);
if(t.spare!=0)//余票不為0
fprintf(fp,"%-20s%4d-%02d-%02d%3d%3d ",t.movie,t.time.year,
t.time.month,t.time.day,t.price,t.spare);
fclose(fp);
}
voidlook(FILE*fp)
{
inti,n=0;
// charch;
fclose(fp);
fp=fopen("電影票.txt","r");
for(i=0;i<N;i++)
{
fscanf(fp,"%s%d-%d-%d%d%d ",a[i].movie,&a[i].time.year,
&a[i].time.month,&a[i].time.day,&a[i].price,&a[i].spare);
if(a[i].spare>0)n++;
}
for(i=0;i<n;i++)
printf("%-20s%4d-%02d-%02d%3d%3d ",a[i].movie,a[i].time.year,
a[i].time.month,a[i].time.day,a[i].price,a[i].spare);
fclose(fp);
}
voidmenu()
{
printf("========電影票管理系統======== ");
printf("1.添加售票2.余票查詢 0.退出程序 ");
printf("============================== ");
printf("功能選項:");
}
intmain()
{
FILE*fp;
charc;
while(1)
{
menu();
scanf("%c",&c);
fp=fopen("電影票.txt","a+");
switch(c)
{
case'1':newticket(fp);break;
case'2':look(fp);break;
case'0':return0;
}
}
}