当前位置:首页 » 课程大全 » 订票系统数据结构课程设计

订票系统数据结构课程设计

发布时间: 2020-11-29 23:19:29

『壹』 数据结构课程设计——飞机订票系统

#include <iostream.h>
#include <stdio.h>
#include <string.h>
#include <conio.h>
#define m 4 //3架飞机
#define n 5 //每架飞机5张票

struct node
{
char name[21];
char id[21];
int seat,plane,date;
node *next,*pre;
};
struct wait
{
char name[21];
char id[21];
char phone[8];
int seat,plane,date,count;
wait *next,*pre;
};
struct piao
{
int seat[n+1];
};

void makenull();
void makenull_piao();
void makenull_information();
void list_menu();
void list_piao();
void makenull_wait();
void list_information();
void plane_information(node *head);
void book();
void add_information(node *head,int x,int y);
void add_wait(int x,int y);
void search_delete(int x);
void write_to_file();
void show_wait();
bool comp(node *x,node*y);

node *head1,*head2,*head3,*q;
wait *wait_head,*wait_end;
char c;
piao a[m];

void main()
{

makenull();
do
{ list_menu();
cout<<endl<<"choose an operation: ";
cin>>c;
if (c!='6')
switch(c)
{
case '0' : show_wait();break;
case '1' : {list_piao();book();}break;
case '2' : search_delete(1);break;
case '3' : list_piao();break;
case '4' : list_information();break;
case '5' : search_delete(0);break;
default : break;
}
}while(c!='6');
cout<<"Exit System ";
}
void makenull()
{
makenull_piao();
makenull_information();
makenull_wait();
}
void list_menu()
{ cout<<endl<<"";
cout<<endl<<" 菜单";
cout<<endl<<" ************************";
cout<<endl<<" * 0 . 查看排队情况 *";
cout<<endl<<" * 1 . 订票 *";
cout<<endl<<" * 2 . 退票 *";
cout<<endl<<" * 3 . 查看剩余票 *";
cout<<endl<<" * 4 . 查看飞机信息 *";
cout<<endl<<" * 5 . 查看乘客信息 *";
cout<<endl<<" * 6 . 退出 *";
cout<<endl<<" ************************";
cout<<endl<<"";
}
void makenull_piao()
{
FILE *fp;
int i;
if((fp=fopen("piao.dat","r")) == NULL )
{
fp=fopen("piao.dat","w");
for (i=1;i<=m-1;i++)
fwrite(&a[i],sizeof(piao),1,fp);
fclose(fp);
fp=fopen("piao.dat","r");
}
for(i=1;i<=m-1;i++)
fread(&a[i],sizeof(piao),1,fp);
fclose(fp);
}
void makenull_information()
{
node *r;
FILE *fp;
int i,j,sum;

sum=a[1].seat[0]+a[2].seat[0]+a[3].seat[0];
fp=fopen("information.dat","r");
head1=new node;
head2=new node;
head3=new node;
head1->pre=NULL;
head1->next=NULL;
head2->pre=NULL;
head2->next=NULL;
head3->pre=NULL;
head3->next=NULL;
q=head1;
for(i=1;i<=sum;i++)
{
j=0;
r=new node;
fread(r,sizeof(node),1,fp);
q->next=r;
r->pre=q;
r->next=NULL;
q=q->next;
fclose(fp);
if(i==a[1].seat[0]+1) {
head2->next=q;
q->pre->next=NULL;
q->pre=head2;
}
if(i==a[1].seat[0]+a[2].seat[0]+1) {
head3->next=q;
q->pre->next=NULL;
q->pre=head3;
}
}
}

void makenull_wait()
{
wait *tempw;
FILE *fp;
tempw=new wait;
int i;
if((fp=fopen("wait.txt","r")) ==NULL )
{
fp=fopen("wait.txt","w");
fclose(fp);
}
wait_end=new wait;
wait_head=new wait;
wait_end->next=NULL;
wait_end->pre=NULL;
wait_head=wait_end;
wait_head->count=0;
fp=fopen("wait.txt","r");
fread(wait_head,sizeof(wait),1,fp);
for(i=1;i<=wait_head->count;i++)
{
fread(tempw,sizeof(wait),1,fp);
wait_end->next=tempw;
tempw->pre=wait_end;
tempw->next=NULL;
wait_end=tempw;
}
}

void list_piao()
{
int i,j;
for(i=1;i<=m-1;i++)
{
if(a[i].seat[0]!=n)
{
cout<<endl<<"第 "<<i<<" 架飞机剩余的票 :"<<endl;
for(j=1;j<=n;j++)
if (a[i].seat[j]==0) cout<<" "<<j;
cout<<endl;
}
else cout<<endl<<"The "<<i<<" plane is full !"<<endl<<endl;
}
}
void list_information()
{
int x;
do {cout<<endl<<"显示哪架飞机的信息 ? "; cin>>x;cout<<endl;}while(x<1 || x>=m);
cout<<endl<<"第 "<<x<<" 架飞机的信息如下 "<<endl;
if(x==1) plane_information(head1);
if(x==2) plane_information(head2);
if(x==3) plane_information(head3);
}

void plane_information(node *head)
{
node *q;
char ch;
int x=0;
if(head!=NULL && head->next!=NULL)
q=head->next;
else {
q=NULL;
cout<<"飞机空,无预订票 !"<<endl;
}
while(q!=NULL)
{
cout<<endl<<"*******************"<<endl;
q->date=q->plane;
cout<<"日期 :"<<q->date<<endl;
cout<<"座位号 : "<<q->seat<<endl;
cout<<"姓名 : "<<q->name;
cout<<endl<<"ID 号 : "<<q->id;
q=q->next;x++;
if (x % 3 ==0) ch=getch();
}
cout<<endl;
}
void book()
{
int i,j,p;
cout<<endl<<"请选择地点:(1、2、3) ";
do {
cin>>i;
if (i<1 || i>=m) {
cout<<endl<<"**** 超出范围!****"<<endl<<"请重新输入:";
}
else
{cout<<endl<<"你要订的是到"<<i<<"地的飞机"<<endl;
cout<<endl<<"第 "<<i<<" 架飞机剩余的票 :"<<endl;
for(p=1;p<=n;p++)
if (a[i].seat[p]==0) cout<<" "<<p;
cout<<endl;
break;}
}while(1);
cout<<endl<<"请选择座位号 : ";
do {
cin>>j;
if (j<1 || j>n) {
cout<<endl<<"**** 超出范围!****"<<endl<<"请重新输入:";
}
else
{
q->date=i;
cout<<endl<<"您的订票日期 : "<<q->date<<endl;
break;
}
}while(1);

if (a[i].seat[j]==0) {
a[i].seat[j]=1;
cout<<endl;
a[i].seat[0]++;
if(i==1) add_information(head1,1,j);
if(i==2) add_information(head2,2,j);
if(i==3) add_information(head3,3,j);
}
else
{
cout<<endl<<"**** 对不起,该座位已被预订,您被安排到订票等候队列 ****"<<endl;
add_wait(i,j);
}

}
void add_wait(int x,int y)
{
wait *tempw;
tempw=new wait;
tempw->next=NULL;
cout<<"请输入个人信息"<<endl;
cout<<endl<<"*************"<<endl;
cout<<"姓名 : ";cin>>tempw->name;
cout<<"ID号 : ";cin>>tempw->id;
cout<<"电话 :";cin>>tempw->phone;
tempw->seat=y;
tempw->plane=x;
wait_end->next=tempw;
tempw->pre=wait_end;
wait_end=wait_end->next;
cout<<endl<<"**** 正在排队等候 ****"<<endl;
wait_head->count++;
write_to_file();
}
void show_wait()
{
wait *tempw;
tempw=wait_head->next;
if (tempw==NULL) cout<<endl<<"排队中没有人!"<<endl;
while(tempw!=NULL)
{
cout<<tempw->name<<" - ";
tempw=tempw->next;
}
}
void add_information(node *head,int x,int y)
{
node *temp;
temp=new node;
temp->pre=NULL;
temp->next=NULL;
cout<<"请输入个人信息"<<endl;
cout<<endl<<"*************"<<endl;
cout<<"姓名 : ";cin>>temp->name;
cout<<"ID号 : ";cin>>temp->id;
temp->seat=y;
temp->plane=x;
temp->next=head->next;
temp->pre=head;
if (head->next!=NULL) head->next->pre=temp;
head->next=temp;
write_to_file();
cout<<endl<<"**** 订票成功 ****"<<endl;
}
void search_delete(int x)
{
node *p,*q,*r;
wait *tempw,*tempw2,*tempw3;
int step=1,t1,t2,i;
char ch;
p=new node;
tempw=new wait;
tempw2=new wait;
tempw3=new wait;
q=head1;
cout<<endl<<"请输入个人信息"<<endl;
cout<<"*************"<<endl;
cout<<endl<<"姓名 : ";cin>>p->name;
do{
q=q->next;
if ( (q!=NULL) &&
(comp(q,p)) )
{
cout<<endl;
q->date=q->plane;
cout<<"Located!"<<endl;
cout<<"****************";
cout<<endl<<"姓名 : "<<q->name;
cout<<endl<<"ID号 : "<<q->id;
cout<<endl<<"座位号 : "<<q->seat;
cout<<endl<<"班机号 : "<<q->plane;
cout<<endl<<"日期 : "<<q->date<<endl;
if (x==1) {
cout<<"删除该纪录 ? [Y/N] ";
cin>>ch;
if (ch=='Y' || ch=='y') {
t1=q->plane;
t2=q->seat;
a[t1].seat[t2]=0;
a[t1].seat[0]--;
r=q;q=q->pre;
r->pre->next=r->next;
if(r->next!=NULL) r->next->pre=r->pre;
delete(r);
cout<<"**** 记录删除成功 ! ****";
write_to_file();
tempw=wait_head;
for(i=0;i<wait_head->count;i++)
{
tempw=tempw->next;
if(tempw==NULL) break;
if((tempw->plane==t1) && (tempw->seat==t2))
{
strcpy(tempw3->name,tempw->name);
strcpy(tempw3->phone,tempw->phone);
cout<<endl<<"等候的人中有可以订票的了:"<<endl;
cout<<endl<<"姓名 : "<<tempw->name;
cout<<endl<<"ID号 : "<<tempw->id<<endl;
a[t1].seat[0]++;
a[t1].seat[t2]=1;
if(tempw->plane==1) add_information(head1,1,tempw->seat);
if(tempw->plane==2) add_information(head2,2,tempw->seat);
if(tempw->plane==3) add_information(head3,3,tempw->seat);
tempw2=tempw->pre;
tempw2->next=tempw->next;
if(tempw->next==NULL) wait_end=tempw2;
else tempw->next->pre=tempw2;
delete(tempw);
wait_head->count--;
write_to_file();
cout<<endl<<"等候的"<<tempw3->name<<"已经成功订票,已经由电话"<<tempw3->phone<<"通知了"<<endl;
break;
}
}

}
}continue;
}
else
{
if (q==NULL)
{
step++;
if(step==2) q=head2;
if(step==3) q=head3;
if(step==4) {cout<<endl<<"**** 信息检索完毕 ****";break;}
}
}
}while(1);
}
bool comp(node *x,node *y)
{
node *p,*q;
int i,j,k;
p=x;
q=y;
i=j=0;
do
{
while ( (p->name[i] != q->name[j]) && (p->name[i] != '\0') ) i++;

if (p->name[i] == '\0') {return(false);break;}
else
{
k=i;
while ( (p->name[k] == q->name[j]) && (q->name[j]!='\0') ) {k++;j++;}
if (q->name[j]=='\0') return(true);
else
{
j=0;
i++;
}
}
}while( (q->name[j]!='\0') && (p->name[i] != '\0') );
return(false);
}

void write_to_file()
{
FILE *fp;
int i,j;
int x[m];
node *p;
wait *tempw;
tempw=new wait;
tempw=wait_head;
fp=fopen("piao.dat","w");
for (i=1;i<=m-1;i++)
{
fwrite(&a[i],sizeof(piao),1,fp);
}
fclose(fp);

fp=fopen("information.dat","w");
x[0]=0;x[1]=a[1].seat[0];
for(i=0,j=1;j<=m-1;j++) {i=i+a[j].seat[0];x[j]=a[j].seat[0]+x[j-1];}
j=1;p=head1->next;
for(j=1;j<=i;j++)
{
if(j==x[1]+1) p=head2->next;
if(j==x[2]+1) p=head3->next;
if(p==NULL)break;
fwrite(p,sizeof(node),1,fp);
p=p->next;
}
fclose(fp);

fp=fopen("wait.txt","w");
for(j=0;j<=wait_head->count;j++)
{
if(tempw==NULL)break;
fwrite(tempw,sizeof(wait),1,fp);
tempw=tempw->next;
}
fclose(fp);
}

『贰』 数据结构课程设计(图书馆借阅管理系统)

图书借阅管理系统具有以下功能:
图书资料管理
图书资料管理主要完成图书资料的新增、修改和报废,并生成图书资料库的功能。按采购员的要求,供书商提供需要的书籍。进行分类新增修改处理。并对已报废图书进行处理。
读者资料管理
读者资料管理主要完成读者资料的新增、修改和撤消,并生成读者资料库。按读者要求进行读者资料的新增、修改和撤消。
借书操作
借书操作主要完成读者的借书、续借及预订处理,并生成读者借阅库。首先进行读者资格的审核,符合要求后查阅书库是否有书,如有则修改图书资料库,书库取书书交读者。书库无书则进行预订处理。用户续借则修改还书日期。并将借书信息汇总后交统计员。
还书操作
还书操作主要完成读者的还书及罚款处理,并修改读者借阅库。首先进行读者资格的审核,符合要求后则修改图书资料库,读者还书书还书库。书籍逾期或遗失则进行罚款处理。并将还书信息汇总后交统计员。
查询处理
查询处理主要完成读者对书是否逾期、书是否未借、书籍排行榜的查询处理。并及时地把查询结果反馈给读者,并将查询信息汇总给统计员。
系统维护
包括权限管理、数据恢复和数据备份。数据恢复和数据备份是对数据的有效保护。权限管理是对系统使用者规定相关的权限,以免系统数据被非法访问和使用。
(访问时需要密码,密码错误要有提示重输,登陆分为管理员登陆和用户登陆两项,用户只能进行查询操作,而管理员能进行所有操作)
#include <string.h>
#include <iostream.h>

class Book{ // 书籍基类
protected:
char Title[40]; // 书名
long Code; // 条码
int Type; // 0表示书,1表示杂志
public:
Book();
Book(char *title,long code);
void SetCode(long code){ Code = code; }
void SetTitle(char* tl){ strcpy(Title,tl); }
void SetType(bool type){Type = type; }
int GetType(){ return Type; }
long GetCode(){ return Code;}
virtual void Show(); // 显示书的信息
friend ostream& operator<<(ostream& , Book&); // 重载插入运算符
friend istream& operator>>(istream& is, Book&); // 重载提取运算符
Book *Next; // 为创建每个读者所借书链表而定义指针
};

class Item :public Book{ //书的款目
// char Title[40]; // 书名
char Author[20]; // 著者名
char IndexCode[10]; // 分类号
// long Code; // 条码
public:
Item();
Item(char *author,char *title,char *index,int code);
Item(Item &);
void SetAuthor(char*);
void SetIndexCode(char*);
virtual void Show(); // 显示书的信息
friend ostream& operator<<(ostream& os, Item&); // 重载插入运算符
friend istream& operator>>(istream& is, Item&); // 重载提取运算符
public:

};

class Magazine:public Book { //杂志类
int Volume;
enum LANG {CHINESE=1,ENGLISH} Lang; // 枚举变量,确定语言类别
public:
Magazine():Book(){Volume = 0; Lang = CHINESE; Type = 1; }
Magazine(char *title,int vol,LANG lang,int code);
Magazine(Magazine&);
void SetVolume(int vol){Volume = vol;}
void SetLang(int lang){Lang = (LANG)lang;}
virtual void Show(); // 显示杂志的信息
friend ostream& operator<<(ostream& os, Magazine&); // 重载插入运算符
friend istream& operator>>(istream& is, Magazine&); // 重载提取运算符
};

class Reader{ // 读者信息类

char Name[20]; // 姓名
char Position[20]; // 职务
int Age; // 年龄
long Code; // 借书证号
Book* items; // 所借书链表
public:
Reader();
Reader(char *name,char *posi,int age,int code);
// Reader(Reader&);
~Reader();
long GetCode(){return Code;}
void SetName(char*);
void SetPosition(char*);
void SetAge(int);
void SetCode(long);
void AddBook(Item); // 添加所借书
void AddBook(Magazine); // 添加所借杂志
void DelBook(Book it); // 还书后减少所借书
void ShowBooks(); // 显示所借书
void Show(); // 显示读者信息
friend ostream& operator<<(ostream& os, Reader&); // 重载插入运算符
friend istream& operator>>(istream& is, Reader&); // 重载提取运算符
public:
int Counter; //计数器,统计所借书数目
};

class Manager{ // 管理员类
char Name[20]; // 姓名
int Age; // 年龄
int Code; // 工号
friend class Library; // 将图书馆类声明为友元
public:
Manager(){}
Manager(char*,int,int);
long GetCode(){ return Code;}
void Show();
friend ostream& operator<<(ostream& os, Manager&); // 重载插入运算符
friend istream& operator>>(istream& is, Manager&); // 重载提取运算符
};

class Loan { // 借阅信息类
int Type; // 0表示书,1表示杂志
Item item; // 借阅书
Magazine mag; // 借阅杂志
Reader reader; // 借阅者
Manager manager; // 借书操作员
int Code;
friend class Library; // 将图书馆类声明为友元
public:
Loan(){ }
Loan(Loan & l);
int GetCode(){ return Code;}
void Show();
friend ostream& operator<<(ostream& os, Loan&); // 重载插入运算符
friend istream& operator>>(istream& is, Loan&); // 重载提取运算符
};
、、、、、、、、、、、、、、、、、、、、、、、
#include<iostream.h>
#include<string.h>
class Reader;
template<typename T> class DblList;
template<typename T> class DblNode{
public:
T Info;//数据域
DblNode<T> *llink,*rlink; //前驱(左链)、后继(右链)指针
public:
DblNode(T data);//一般结点
DblNode();//头结点
T GetInfo(){return Info;};
friend class DblList<T>;
friend class Library;
};

template<typename T>class DblList{
DblNode<T> *head,*current;
public:
DblList();
~DblList();
void Insert(const T& data);
DblNode<T>* Remove(DblNode<T>* p);
void Print();
int Length();//计算链表长度
DblNode<T> *Find(T data);//搜索数据与定值相同的结点
DblNode<T>* Find(int data);//按某个关键字查找
void MakeEmpty(); //清空链表
void ShowList(); //显示链表各结点
friend istream& operator>>(istream&, DblList<typename T>&); // 重载输入流运算符

friend ostream& operator<<(ostream& os, DblList<typename T>& dlist); // 重载输出流运算符
friend class Library;
//其它操作
};

template<typename T> DblNode<T>::DblNode(){
llink=rlink=NULL;
}
template<typename T> DblNode<T>::DblNode(T data){
info=data;
llink=NULL;
rlink=NULL;
}

template<typename T> DblList<T>::DblList(){//建立表头结点
head=new DblNode<T>();
head->rlink=head->llink=head;
current=NULL;
}
template<typename T> DblList<T>::~DblList(){
MakeEmpty();//清空链表
delete head;
}
template<typename T> void DblList<T>::MakeEmpty(){
DblNode<T> *tempP;
while(head->rlink!=head){
tempP=head->rlink;
head->rlink=tempP->rlink;//把头结点后的第一个节点从链中脱离
tempP->rlink->llink=head;//处理左指针
delete tempP; //删除(释放)脱离下来的结点
}
current=NULL; //current指针恢复
}
template<typename T> void DblList<T>::Insert(const T & data){//新节点在链尾
current=new DblNode<T>;
current->Info=data;
current->rlink=head;//注意次序
current->llink=head->llink;
head->llink->rlink=current;
head->llink=current;//最后做
}
template<typename T> DblNode<T>* DblList<T>::Remove(DblNode<T>* p){ // 删除结点
current=head->rlink;
while(current!=head&¤t!=p) current=current->rlink;
if(current==head) current=NULL;
else{//结点摘下
p->llink->rlink=p->rlink;
p->rlink->llink=p->llink;
p->rlink=p->llink=NULL;
}
return current;
}

template<typename T> DblNode<T>* DblList<T>::Find(T data){ // 按结点查找
current=head->rlink;
while(current!=head&¤t->Info!=data) current=current->rlink;
if(current==head) current=NULL;
return current;
}

template<typename T> DblNode<T>* DblList<T>::Find(int data){ // 按数据值查找结点
current=head->rlink;
int temp =current->Info.GetCode();
while(current!=head&&temp!=data){
current=current->rlink;
temp = current->Info.GetCode();
}
if(current==head) current=NULL;
return current;
}

template<typename T> void DblList<T>::Print(){ // 输出链表
current=head->rlink;
while(current!=head){
cout<<current->Info<<'\t';
current=current->rlink;
}
cout<<endl;
}
template<typename T> int DblList<T>::Length(){ // 取得链表长度
int count=0;
current=head->rlink;
while(current!=head){
count++;
current=current->rlink;
}
return count;
}

template<typename T> void DblList<T>::ShowList(){ // 输出链表各结点
int count=0;
current=head->rlink;
while(current!=head){
current->GetInfo().Show();
current=current->rlink;
}
return ;
}

template<typename T>
istream& operator>>(istream& is, DblList<typename T> &dlist){
int len;
T tt; // 定义局部变量读入一个结点
is>>len;
for(int i= 0 ;i<len; i++){ // 循环读入链表各结点
is>>tt;
dlist.Insert(tt);
}
return is;
}

template<typename T>
ostream& operator<<(ostream& os, DblList<typename T> &dlist){
DblNode<T> *tempP;
int len = dlist.Length();
os<<len<<' ';
tempP=dlist.head->rlink;
while(tempP!=dlist.head){ // 循环输出链表各结点
os<<tempP->Info;
tempP = tempP->rlink;
}
return os;
}
#include "class.h"
#include "dblist.h"
#include <fstream.h>
class Library{ // 封装图书馆流通业务的类
DblList<Item> item; // 在馆图书链表
DblList<Magazine> mag; // 在馆杂志链表
DblList<Reader> reader; // 读者链表
DblList<Loan> loan; // 借阅信息链表
DblList<Manager> manager; // 管理员信息链表

int itemNum; // 记录在馆图书数目
int magNum; // 记录在馆杂志数目
int readerNum; // 记录读者数目
int loanNum; // 记录借阅信息数目
int managerNum; // 记录管理员数目
ofstream itemFileOut; // 文件流对象,保存图书馆书籍数据
ifstream itemFileIn; // 文件流对象,读入图书馆书籍数据
ofstream magFileOut; // 文件流对象,保存图书馆杂志数据
ifstream magFileIn; // 文件流对象,读入图书馆杂志数据
ofstream readerFileOut; // 文件流对象,保存图书馆读者数据
ifstream readerFileIn; // 文件流对象,读入图书馆读者数据
ofstream loanFileOut; // 文件流对象,保存图书馆借阅信息数据
ifstream loanFileIn; // 文件流对象,读入图书馆借阅信息
ofstream managerFileOut; // 文件流对象,保存图书馆管理员数据
ifstream managerFileIn; // 文件流对象,读入图书馆管理员数据
public:
Library(); // 构造函数
~Library(); //析构函数
void Run(); // 图书馆类的运行函数
void CreateBibliotheca(); // 创建书目
void CreateReader(); // 创建读者库
void CreateManager(); // 创建管理员信息
int ShowMainMenu(); // 显示主菜单函数
void Borrow(); // 借书操作
void Return(); // 还书操作
void Require(); // 查询操作
void SaveInfo(); // 保存图书馆信息
void OpenInfo(); // 读入图书馆信息
};
多给点分吧

『叁』 JAVA数据结构课程设计,航空订票系统求助


今天比较闲,编了一套,一共4个class。不懂再问。

这格式真要命,凑活看吧。

publicenumAirClass{
FIRST,
SECOND,
THIRD
}

--------------------------------------------


publicclassCustomer{
privateStringname;
privateintticketNumber;
privateAirClassairClass;
publicCustomer(Stringname,intticketNumber,AirClassairClass){
this.name=name;
this.ticketNumber=ticketNumber;
this.airClass=airClass;
}
publicStringgetName(){returnname;}
publicvoidsetName(Stringname){this.name=name;}
publicintgetTicketNumber(){returnticketNumber;}
publicAirClassgetAirClass(){returnairClass;}
}

------------------------------------------------


importjava.util.LinkedList;
importjava.util.List;

publicclassAirLine{
privateStringdestination;
privateStringflightName;
privateStringflightNumber;
privateintdayOfWeek;
privateintcapacity;
privateintremainder;
privateList<Customer>booking=newLinkedList<Customer>();
privateList<Customer>preBooking=newLinkedList<Customer>();

publicAirLine(Stringdestination,StringflightName,StringflightNumber,intdayOfWeek,intcapacity){
this.destination=destination;
this.flightName=flightName;
this.flightNumber=flightNumber;
this.dayOfWeek=dayOfWeek;
this.capacity=capacity;
this.remainder=capacity;}
publicStringgetDestination(){returndestination;}
publicStringgetFlightName(){returnflightName;}
publicStringgetFlightNumber(){returnflightNumber;}
publicintgetDayOfWeek(){returndayOfWeek;}
publicintgetCapacity(){returncapacity;}
publicintgetRemainder(){returnremainder;}
publicList<Customer>getBooking(){returnbooking;}
publicList<Customer>getPreBooking(){returnpreBooking;}

publicbooleanaddBooking(Customerc){
if(this.remainder>=c.getTicketNumber()){
this.remainder=this.remainder-c.getTicketNumber();
this.booking.add(c);
returntrue;
}else{
this.preBooking.add(c);
returnfalse;
}
}

publicvoidremoveBooking(Customerc){
if(this.booking.contains(c)){
this.booking.remove(c);
this.remainder=this.remainder+c.getTicketNumber();
}else{
("Customernotfound.");
}
}

publicvoidremovePreBooking(Customerc){
if(this.preBooking.contains(c)){
this.preBooking.remove(c);
}else{
("Customernotfound.");
}
}

publicStringtoString(){
returnthis.flightName+":"+this.flightNumber+":"
+this.dayOfWeek+":"+this.remainder;
}
}

---------------------------------


importjava.util.Calendar;importjava.util.Date;
importjava.util.LinkedList;importjava.util.List;
importjava.util.concurrent.TimeUnit;

publicclassMain{
privateList<AirLine>airLines=newLinkedList<AirLine>();

privatevoidinit(){
finalAirLineairLine1=newAirLine("beijing","flightName","flightNumber",Calendar.MONDAY,300);
this.airLines.add(airLine1);
//自己加新的airLine2,airLine3...

finalCustomercustomer1=newCustomer("Tom",2,AirClass.FIRST);
airLine1.addBooking(customer1);
//自己加新的customer2,customer3...
}

publicAirLinesearch(Stringdestination){
if(destination==null)returnnull;
finalintcurrenDayOfWeek=Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
AirLineres=null;
intdiffToCurrenDate=7;
for(AirLinea:airLines){
if(destination.equals(destination)){
if(res==null){
res=a;
continue;
}
intdiff=a.getDayOfWeek()-currenDayOfWeek;
if(diff<0)diff=diff+7;
if(diff<diffToCurrenDate){
diffToCurrenDate=diff;
res=a;
}
}
}
if(res==null){
System.out.println("Notfound");
}else{
System.out.println("日期"+newDate(System.currentTimeMillis()+TimeUnit.DAYS.toMillis(diffToCurrenDate))+":"+res.toString());
}
returnres;
}

publicvoidbooking(AirLinea,Customerc){
if(a.addBooking(c)){
System.out.println("订到了");
}else{
System.out.println("排队中");
}
}

publicvoidcancel(AirLinea,Customerc){
a.removeBooking(c);
for(Customerpre:a.getPreBooking()){
if(a.addBooking(pre)){
a.removePreBooking(pre);
System.out.println("排队的订到了");
break;
}else{
System.out.println("票余量不够当前面排队的人,下一个");
}
}
}
}

『肆』 图书管理系统--数据结构课程设计

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

struct BOOK
{
int id,usr[10],total,store,days[10];
char name[30],author[20];
}books[100];
/*结构体,存放书籍及借书信息。*/

void page_title(char *menu_item)
{
printf(">>> 以下是图 书 管 理 系 统--请 按 要 求 操 作 <<<\n\n- %s -\n\n",menu_item);
}
/*页头函数,可以通过参数menu_item,显示当前状态。*/

void return_confirm(void)
{
printf("\n任意键返回……\n");
getch();
}
/*返回前请求确认函数,方便返回前观察结果*/

int search_book(void)
{
int n,i;
printf("请输入图书序号:");
scanf("%d",&i);
for(n=0;n<100;n++)
{
if(books[n].id==i)
{
printf("书名:%s\n",books[n].name);
printf("作者:%s\n",books[n].author);
printf("存数:%d\n",books[n].store);
printf("总数:%d\n",books[n].total);
return n;
}
}
printf("\n输入有错或图书序号不存在.\n");
return -1;
}
/*上面是在数组中找到图书号匹配的记录,显示其信息并返
回数组下标,如果找不到相应记录则提示错误并返回-1。*/

void book_out(void)
{
int n,s,l,d;
page_title("借书");
if((n=search_book())!=-1&&books[n].store>0)
{
printf("请输入借书证序号:");
scanf("%d",&s);
printf("请输入可借天数:");
scanf("%d",&d);
for(l=0;l<10;l++)
{
if(books[n].usr[l]==0)
{
books[n].usr[l]=s;
books[n].days[l]=d;
break;
}
}
books[n].store--;
}
if(n!=-1&&books[n].store==0) printf("此书已经全部借出.\n");
return_confirm();
}
/*借书的函数,首先调用找书函数*/

void book_in(void)
{
int n,s,l;
page_title("还书");
if((n=search_book())!=-1&&books[n].store<books[n].total)
{
printf("借阅者图书证列表:\n");
for(l=0;l<10;l++)
if (books[n].usr[l]!=0)
printf("[%d] - %d天\n",books[n].usr[l],books[n].days[l]);
printf("请输入借书证序号:");
scanf("%d",&s);
for(l=0;l<10;l++)
{
if(books[n].usr[l]==s)
{
books[n].usr[l]=0;
books[n].days[l]=0;
break;
}
}
books[n].store++;
}
if(n!=-1&&books[n].store==books[n].total)
printf("全部入藏.\n");
return_confirm();
}

void book_add(void)
{
int n;
page_title("注册书");
for(n=0;n<100;n++)
if(books[n].id==0) break;
printf("序号:");
scanf("%d",&books[n].id);
printf("书名:");
scanf("%s",&books[n].name);
printf("作者:");
scanf("%s",&books[n].author);
printf("数量:");
scanf("%d",&books[n].total);
books[n].store=books[n].total;
return_confirm();
}

void book_del(void)
{
int n;
page_title("注销书");
if((n=search_book())!=-1) books[n].id=0;
printf("该书已注销.\n");
return_confirm();
}

void main(void)
{
menu: page_title("操作选择单子");
printf("请按以上要求选择操作\n\n");
printf("1 借书\n2 还书\n\n");
printf("3 注册书\n4 注销书\n\n");
printf("\n0 退出\n");
switch(getch())
{
case '1' : book_out();break;
case '2' : book_in();break;
case '3' : book_add();break;
case '4' : book_del();break;
case '0' : exit(0);
}
goto menu;
}

『伍』 数据结构课程设计订票系统运用到的算法思想是什么急

队列的算法思想吧

『陆』 数据结构课程设计……关于飞机票系统 哪位高手帮我做做啊

汗,难道这个课的老师不能换点题材吗?当年我们也是写这个,还要答辩.....
用VB写下很简单的啊楼主,看你的要求还没涉及到网络联机...当初我们写的时候要求最少2电脑,一台写服务器,一台写客户端,实现查询、定退票....权限等等....比较烦,你这个自己写下吧!

建议最少给100分,可能有人会帮你写,即便是这样的功能,少说也有1000行代码了!

『柒』 数据结构课程设计 铁路票务管理系统

#include<fstream>
#include<iostream>
#include<string>
#include<stdio.h>
#include<iomanip>
#define SIZE_view 50
#define SIZE_line 100
#define SIZE_way 300

#define MAXNODE 30 //定义最多的顶点数
#define MAXCOST 1000
//自己写的头文件
//#include<addview.h>// //

using namespace std;

struct view_info /*城市信息结构*/
{
int id;
char name[20];
int code;
char shortname[20];
char LName[100];// 经过此车站的铁路线名称
} views[SIZE_view];

struct line_info //铁路线信息结构
{
int Lid;
char LName[20];
int start_id; //始发站id
int end_id; //终点站id
int dist; //铁路线长度
int sign;//通行标志
}lines[SIZE_line];

struct way_info //铁路度的信息结构
{
int station1;
int station2;
int dist;
}ways[SIZE_way];

struct path_info //用于最短路径的查询

{
int count;
int path[SIZE_view];
};

int view_count,line_count,way_count;//用来存储文件中有多少条记录

void readviews()
{
int i;
ifstream infile("views.txt",ios::in); //打开文件
infile >>view_count ; //把文件中的记录赋值给view_count
if(!infile) //打开文件失败
{
cerr<<"open error!"<<endl;
exit(1);
}
//infile>>view_count; // 先读入文件个数
for(i=0;i<view_count;i++)
{
infile>>views[i].id>>views[i].name>>views[i].code>>views[i].shortname>>views[i].LName;

}
//view_count=i;//给出原文件中车站的个数
infile.close();
cout<<" "<<"id"<<" "<<"name"<<" "<<"code"<<" "<<"shortname"<<" "<<"LName"<<endl;
for(i=0;i<view_count;i++)
cout<<" "<<views[i].id<<" "<<views[i].name<<" "<<views[i].code
<<" "<<views[i].shortname<<" "<<views[i].LName<<endl;

}

void readways() //读文件ways.txt
{
int i;
ifstream infile("ways.txt",ios::in); //打开文件
infile>>way_count; ////把文件中的记录赋值给way_count
if(!infile) //打开文件失败
{
cerr<<"open error!"<<endl;
exit(1);
}
for(i=0;i<way_count;i++)
infile>>ways[i].station1>>ways[i].station2>>ways[i].dist;
infile.close();
//测试用,输出路段的信息
cout<<" "<<"station1"<<" "<<"station2"<<" "<<"dist"<<endl;
for(i=0;i<way_count;i++)
cout<<" "<<ways[i].station1<<" "<<ways[i].station2<<" "<<ways[i].dist<<endl ;

}

void readlines() //读文件lines.txt
{
int i;
ifstream infile("lines.txt",ios::in); //打开文件
infile>>line_count; //把文件中的记录赋值给line_count
if(!infile) //打开文件失败
{
cerr<<"open error!"<<endl;
exit(1);
}
for(i=0;i<line_count;i++)
infile>>lines[i].Lid>>lines[i].LName>>lines[i].start_id>>lines[i].end_id>>lines[i].dist>>lines[i].sign;
infile.close();

/*
cout<<" "<<"Lid"<<" "<<"LName"<<" "<<"start_id"<<" "<<"end_id"<<" "<<"dist"<<" "<<"sign"<<endl;
for(i=0;i<view_count;i++)
cout<<" "<<lines[i].Lid<<" "<<lines[i].LName<<" "<<lines[i].start_id
<<" "<<lines[i].end_id<<" "<<lines[i].dist<<" "<<lines[i].sign<<endl;

*/ //这里是输出文件中的信息

}

void search () //查询车站信息(所在的铁路线)
{
cout<<"please enter the station name:";
char sta_name[20];
cin>>sta_name; //输入要查询的名字
cout<<endl;
ifstream infile("views.txt ",ios::in); //读文件
infile >>view_count ; //读出文件记录的个数
if(!infile) //打开文件失败
{
cerr<<"open error!"<<endl;
exit(1);
}
int i,mark;
for(i=0;i<view_count;i++)
infile>>views[i].id>>views[i].name>>views[i].code>>views[i].shortname>>views[i].LName;
infile.close();
for(i=0;i< view_count;i++)
{
if(strcmp(sta_name,views [i].name)==0) //找到车站
{
cout<<"the station's informations is:\n"<<endl;
cout<<" "<<"id"<<" "<<"name"<<" "<<"code"<<" "<<"shortname"<<" "<<"LName"<<endl;
cout<<" "<<views[i].id<<" "<< views[i].name<<" "<< views [i].code
<<" "<< views [i].shortname<<" "<< views [i].LName <<endl;
break;
}
mark=i;

}
if(mark==( view_count -1)) //若没有找到,输出提示
{
cout<<"sorry,the station is not in here"<<endl;
}
}

void addview()
{
cout<<"please enter the new view's informations:"<<endl; //输入新车站信息
cout<<"id:";
cin>>views[view_count].id;
cout<<"name:";
cin>>views[view_count].name;
cout<<"code:";
cin>>views[view_count].code;
cout<<"shortname:";
cin>>views[view_count].shortname;
cout<<"LName:";
cin>>views[view_count].LName;

ofstream outfile("views.txt",ios::app); //打开views文件,并且写入数据
outfile<<view_count<<endl;
if(!outfile) //文件打开失败
{
cerr<<"open error!"<<endl;
exit(1);
}
outfile<<views[view_count].id<<" "<<views[view_count].name<<" "<<views[view_count].code
<<" " <<views[view_count].shortname<<" "<<views[view_count].LName<<endl;
//在文件末尾添加
view_count=view_count+1;

outfile.close(); //关闭文件
cout<<"successfully! the new station is added"<<endl;
cout<<"now station number is:"<<view_count<<endl;

}

void addway()
{
cout<<"please enter the new way's informations:"<<endl; //输入新车站信息
cout<<"station1:";
cin>>ways[way_count].station1; // station1的id
cout<<"station2:";
cin>>ways[way_count].station2; //station2的id
cout<<"dist:";
cin>>ways[way_count].dist; //路段的长度

ofstream outfile("ways.txt",ios::app); //打开way.txt文件
outfile<<way_count<<endl;
if(!outfile) //文件打开失败
{
cerr<<"open error!"<<endl;
exit(1);
}
outfile<<ways[way_count].station1<<" "<<ways[way_count].station2<<" "<<ways[way_count].dist;
//在文件末尾添加

outfile.close(); //关闭文件
cout<<"successfully! the new station is added"<<endl;
way_count=way_count+1;
cout<<"now station number is:"<<view_count<<endl;

}

void addline()
{
cout<<"please enter the new line's informations:"<<endl; //输入新铁路线信息
cout<<"Lid:";
cin>>lines[line_count].Lid;
cout<<"LName:";
cin>>lines[line_count].LName;
cout<<"start_id:";
cin>>lines[line_count].start_id;
cout<<"end_id:";
cin>>lines[line_count].end_id;
cout<<"dist:";
cin>>lines[line_count].dist;
cout<<"sign:";
cin>>lines[line_count].sign;

ofstream outfile("lines.txt",ios::app); //打开文件
outfile <<line_count << endl;
if(!outfile) //文件打开失败
{
cerr<<"open error!"<<endl;
exit(1);
}
outfile<<lines[line_count].Lid<<" "<<lines[line_count].LName<<" "<<lines[line_count].start_id
<<" " <<lines[line_count].end_id<<" "<<lines[line_count].dist<<lines[line_count].sign<<endl;
//在文件末尾添加

outfile.close(); //关闭文件
cout<<"successfully! the new line is added"<<endl;
line_count=line_count+1;
cout<<"now line number is:"<<line_count<<endl;

}

//-----------------------------------------------------------------------------------

void floyed() //弗洛伊德(Floyed)算法
{

int i, j, k, m, start_num, end_num; //i,j用来表示起始点和终点
int dist_list[SIZE_view][SIZE_view]; //定义了一个数组
view_count=view_count+1;
struct path_info path_list[SIZE_view][SIZE_view]; //定义了一个path_info结构的变量,包含着count和path[]用来存储经过的路径
for(i=1;i<=view_count;i++) //这里开始读文件,先让所有的线都为最大值
for(j=1;j<=view_count;j++)
dist_list[i][j]=MAXCOST;

for(int t=0;t<=way_count;t++)
{
i=ways[t].station1;
j=ways[t].station2;
dist_list[i][j]=ways[t].dist;//把文件中的数据赋值给dist_list[i][j]=ways[t].dist;形式

}

for (i =0; i< view_count; i++)
{
for (j= 0; j<view_count; j++)
{
if (i == j)
{
dist_list[i][j] = 0;
continue;
}

dist_list[i][j] = -1;
path_list[i][j].count = 0;
for (k = 0; k< way_count; k++) //
{
if (ways[k].station1 == i && ways[k].station2 == j) //把起始点和终点分别给予i,j

{
dist_list[i][j] = ways[k].dist;
path_list[i][j].count = 2;
path_list[i][j].path[0] = i;
path_list[i][j].path[1] = j;
break;
}

}

}

}

for (k = 0; k<= view_count-1; k++)
{
for (i = 0; i < view_count; i++)
for (j = 0; j< view_count; j++)
{
if (i == k || j == k || i == j)
continue;
if (dist_list[i][k] == -1 || dist_list[k][j] == -1)
continue;
if ( (dist_list[i][j] == -1) ||
((dist_list[i][j] != -1) &&(dist_list[i][k] + dist_list[k][j] < dist_list[i][j])))
{
dist_list[i][j] = dist_list[i][k] + dist_list[k][j];
// shortest[i][j]=shortest[i][k]+shortest[k][j];
path_list[i][j].count = path_list[i][k].count + path_list[k][j].count - 1;
// path[i][j]=k;
for (m = 0; m < path_list[i][k].count; m++)
path_list[i][j].path[m] = path_list[i][k].path[m];
for (m = 0; m < path_list[k][j].count; m++)
path_list[i][j].path[m+path_list[i][k].count] = path_list[k][j].path[m+1];

}

}
}

cout<<" Floyed table:\n";
cout<<" All views in the school:\n";
for (i = 0; i < view_count-1; i++)
cout<<" "<<i+1<<":"<<views[i].name<<endl;

cout<<" Please input the start number: ";
cin>>start_num;
cout<<" Please input the end number: ";
cin>>end_num;
cout<<endl<<endl;

cout<<"From"<<views[start_num-1].name<<"to"<<views[end_num-1].name;
if (dist_list[start_num][end_num] == -1)
cout<<"no way."<<endl;
else
{
cout<<"distance is "<<dist_list[start_num][end_num]<<", and path is :";//dist_list[][]用来表示两点间的长度
k = path_list[start_num][end_num].path[0]-1; //path_list[][]用来保存路径path[m]在这里表明是通过的那个车站的
cout<<views[k].name;
for (m = 1; m < path_list[start_num][end_num].count; m++)
{
k = path_list[start_num][end_num].path[m]-1; //这里应该也是int型,k是经过的路径的id
cout<<"->"<<views[k].name;
}
}
cout<<endl<<endl;
}

void main()
{
readviews();
readlines() ;
readways();

while(1)
{

int menu;
cout<<endl<<endl<<endl<<endl;
cout<<" 全国铁路运输网最佳经由系统 "<<endl;
cout<<"**********************************************************"<<endl;
cout<<" 1:增加车站信息 "<<endl;
cout<<" 2:增加铁路线信息 "<<endl;
cout<<" 3:查询车站信息 "<<endl;
cout<<" 4:查询最短路径 "<<endl;
cout<<" 5:退出界面 "<<endl;
cout<<"**********************************************************"<<endl;

cout<<"输入要进行的操作的代码(1--5):"<<endl;
cin>>menu;
while(menu<1||menu>5)
{
cout<<"error!please enter again:";
cin>>menu;
}
switch(menu)
{
case 1:
while(1)
{
addview();
while (1)
{
addway();
cout<<"do you want to continue (y/n) "<<endl;
char con ;
cin>>con;
if(con=='y')
addway();
else
break;

}
cout<<"do you want to continue (y/n) "<<endl;
char con ;
cin>>con;
if(con=='y')
addview();
else
break;

}

break;
case 2:
while(1)
{
addline();
cout<<"do you want to continue (y/n) "<<endl;
char con ;
cin>>con;
if(con=='y')
addline();
else
break;

}

break;

case 3:
while(1)
{
search ();
cout<<"do you want to continue (y/n) "<<endl;
char con ;
cin>>con;
if(con=='y')
search ();
else
break;

}

break;
case 4:
while(1)
{
floyed();
cout<<"do you want to continue (y/n) "<<endl;
char con ;
cin>>con;
if(con=='y')
floyed();
else
break;

}

break;
case 5:
{
cout<<"谢谢使用,再见!"<<endl;
exit(1);
}

}
}
}

『捌』 数据结构课程设计——航空订票系统(C语言)

1、任务:航空客运定票的业务活动包括:查询航线、客票预定和办理退票等。试设计一个航空客运定票系统,以使上述业务可以借助计算机来完成。 2、功能要求: 1) 录入:可以录入航班情况(数据可以存储在一个数据文件中,数据结构、具 体数据自定) 2) 查询:可以查询某个航线的情况(如,输入航班号,查询起降时间,起飞抵 达城市,航班票价,票价折扣,确定航班是否满仓);可以输入起飞抵达城市, 查询飞机航班情况; 3) 订票:(订票情况可以存在一个数据文件中,结构自己设定)可以订票,如果 该航班已经无票,可以提供相关可选择航班; 4) 退票: 可退票,退票后修改相关数据文件; 5) 客户资料:有姓名,证件号,订票数量及航班情况,订单要有编号; 6) 修改航班信息:当航班信息改变可以修改航班数据文件。 3、要有一个好的界面~~~~~~~~~~~~~~~~~~~~~~~~4、需求分析 系统需求(系统要求实现的功能的具体情况)5、 概要设计 系统分析(分析系统的功能和具体模块的划分) 系统流程(系统的流程图) 程序详细代码:

『玖』 求一份学生管理系统课程设计报告,数据结构课程设计

|”

为什么要中间拿那么多空格隔开呢?逗号或“|”都比那好弄。

如果这题是老师出的,老师一定脑袋有问题。

//==============

效果图查询自己写

需要的控件

private System.Windows.Forms.Button button1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RichTextBox richTextBox2;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;

后台

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text;
using System.IO;

namespace WindowsFormsApplication1
{
public partial class cj : Form
{
public StreamWriter SW;
public cj()
{
InitializeComponent();
string Header = "姓名" + " " + "学号" + " " + "语文" + " " + "数学" + " " + "英语" + " ";
richTextBox1.AppendText(Header);
richTextBox2.AppendText(Header);
CheckDirectory();
}

private void button1_Click(object sender, EventArgs e)
{
string strFile;
strFile = System.Windows.Forms.Application.StartupPath + "\3.txt";
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "文本文件(*.txt)|*.txt";
openFileDialog1.DefaultExt = "txt";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string FileName = openFileDialog1.FileName;

if (Path.GetExtension(FileName) != ".txt")
{
MessageBox.Show("格式不对");
}
else
{

FileStream stream = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read);
StreamReader sReader = new StreamReader(openFileDialog1.FileName, Encoding.Default);
if (sReader.ReadLine().Split(' ').Length > 0)
{
richTextBox1.AppendText(sReader.ReadToEnd());
}
richTextBox1.AppendText(" ");

// StreamWriter ssw = new System.IO.StreamWriter(FileName, true, System.Text.Encoding.Default);


}


}

}


private void WriteLog(string msg)
{
string strFile;
strFile = System.Windows.Forms.Application.StartupPath + "\data\3.log";
// StreamWriter SW;
try
{
SW = new System.IO.StreamWriter(strFile, true);


SW.WriteLine(msg);
}
catch (Exception ex)
{
WriteLog(ex.Message);
}
finally
{
SW.Flush();
SW.Close();
}

}

private void button2_Click(object sender, EventArgs e)
{
richTextBox1.Text = "姓名" + " " + "学号" + " " + "语文" + " " + "数学" + " " + "英语" + " ";
}

private void CheckDirectory()
{

if (Directory.Exists(System.Windows.Forms.Application.StartupPath + "\data") == false)
{
Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\data");
}
if (Directory.Exists(System.Windows.Forms.Application.StartupPath + "\data") == false)
{
Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\data");
}
}

private void button3_Click(object sender, EventArgs e)
{
string rowdata = "";


int m = richTextBox1.Lines.Length;
string[] lines = new string[m];
for (int i = 1; i < m-1; i++) //每一行
{
lines[i] = richTextBox1.Lines[i]+" ";

string[] cj = lines[i].Split(' ');


if (cj != null)
{
rowdata = " ";
for (int j = 0; j < cj.Length; j++) //每一列
{
if (cj[j].ToString() != "")
{
rowdata = rowdata + cj[j].ToString()+",";
}

}
rowdata.TrimEnd(',');

string[] ncj = rowdata.Split(',');

string str2 = ncj[2].ToString();
string str3 = ncj[3].ToString();
string str4 = ncj[4].ToString().TrimEnd(' ');

// if ((int.Parse(str2) + int.Parse(str3) + int.Parse(str4) < 180))
if ((int.Parse(str2)<60 || int.Parse(str3)<60 || int.Parse(str4) < 60))
{
richTextBox2.AppendText(lines[i]);
}

}



}


if (File.Exists(System.Windows.Forms.Application.StartupPath + "\data\3.txt") == true)
{
File.Delete(System.Windows.Forms.Application.StartupPath + "\data\3.txt");
}
File.AppendAllText(System.Windows.Forms.Application.StartupPath + "\data\3.txt", richTextBox1.Text);


if (File.Exists(System.Windows.Forms.Application.StartupPath + "\data\4.txt") == true)
{
File.Delete(System.Windows.Forms.Application.StartupPath + "\data\4.txt");
}
File.AppendAllText(System.Windows.Forms.Application.StartupPath + "\data\4.txt", richTextBox2.Text);



MessageBox.Show("数据合成OK,在data文件夹");
}

}
}

『拾』 数据结构课程设计:电费核算系统

数据结构是计算机存储、组织数据的方式。数据结构是指相互之间存在一种或多种特定关系的数据元素的集合。通常情况下,精心选择的数据结构可以带来更高的运行或者存储效率。
一、数据的逻辑结构:指反映数据元素之间的逻辑关系的数据结构,其中的逻辑关系是指数据元素之间的前后件关系,而与他们在计算机中的存储位置无关。逻辑结构包括:
1.集合结构
数据结构中的元素之间除了"同属一个集合" 的相互关系外,别无其他关系;
2.线性结构
数据结构中的元素存在一对一的相互关系;
3.树形结构
数据结构中的元素存在一对多的相互关系;
4.图形结构
数据结构中的元素存在多对多的相互关系。
二、数据的物理结构:指数据的逻辑结构在计算机存储空间的存放形式。
数据的物理结构是数据结构在计算机存储器中的具体实现,是逻辑结构的表示(又称存储映像),它包括数据元素的机内表示和关系的机内表示。由于具体实现的方法有顺序、链接、索引、散列等多种,所以,一种数据结构可表示成一种或多种存储结构。
数据元素的机内表示(映像方法): 用二进制位(bit)的位串表示数据元素。通常称这种位串为节点(node)。当数据元素有若干个数据项组成时,位串中与个数据项对应的子位串称为数据域(data field)。因此,节点是数据元素的机内表示(或机内映像)。
关系的机内表示(映像方法):数据元素之间的关系的机内表示可以分为顺序映像和非顺序映像,常用两种存储结构:顺序存储结构和链式存储结构。顺序映像借助元素在存储器中的相对位置来表示数据元素之间的逻辑关系。非顺序映像借助指示元素存储位置的指针(pointer)来表示数据元素之间的逻辑关系。

热点内容
武汉大学学生会辅导员寄语 发布:2021-03-16 21:44:16 浏览:612
七年级学生作文辅导学案 发布:2021-03-16 21:42:09 浏览:1
不屑弟高考成绩 发布:2021-03-16 21:40:59 浏览:754
大学毕业证会有成绩单 发布:2021-03-16 21:40:07 浏览:756
2017信阳学院辅导员招聘名单 发布:2021-03-16 21:40:02 浏览:800
查询重庆2018中考成绩查询 发布:2021-03-16 21:39:58 浏览:21
结业考试成绩怎么查询 发布:2021-03-16 21:28:40 浏览:679
14中医医师资格笔试考试成绩查分 发布:2021-03-16 21:28:39 浏览:655
名著赏析课程标准 发布:2021-03-16 21:27:57 浏览:881
北京大学商业领袖高端培训课程 发布:2021-03-16 21:27:41 浏览:919