eval_update
function[idealpoint,subproblems]=eval_update(idealpoint, subproblems,inds)
%EvaluationUpdate Summary of this function goes here
%Detailed explanation goes here
objs=[inds.objective];
weights=[subproblems.weight];
idealpoint=min(idealpoint,min(objs,[],2));
for i=1:length(inds)
subobjs=subobjective(weights,objs(:,i),idealpoint,'ws');
%update the values.
C=subobjs<[subproblems.optimal];
if any(C)
ncell=num2cell(subobjs(C));
[subproblems(C).optimal]=ncell{:};
[subproblems(C).optpoint]=deal(inds(i));
end
end
end
evaluate
function[v,x]=evaluate(prob,x)
%EVALUATE function evaluate an individual structure of a vector point with
%the given multiobjective problem.
%Detailed explanation goes here
%prob:is the multiobjective problem.
%x:is a vector point,or a individual structure.
%v:is the result objectives evaluated by the mop.
%x:if x is a individual structure,then x's objective field is modified
%with the evaluated value and pass back.
%TODO,need to refine it to operate on a vector of points. if isstruct(x)
v=prob.func(x.parameter);
x.objective=v;
else
v=prob.func(x);
end
gaussian_mutate
function ind=gaussian_mutate(ind,prob,domain)
%GAUSSIAN_MUTATE Summary of this function goes here
%Detailed explanation goes here
if isstruct(ind)
x=ind.parameter;
else
x=ind;
end
parDim=length(x);
lowend=domain(:,1);
highend=domain(:,2);
sigma=(highend-lowend)./20;
newparam=min(max(normrnd(x,sigma),lowend),highend);
C=rand(parDim,1) x(C)=newparam(C); if isstruct(ind) ind.parameter=x; else ind=x; end genetic_op function ind=genetic_op(subproblems,index,domain,params) %GENETICOP function implemented the DE operation to generate a new %individual from a subproblems and its neighbours. %subproblems:is all the subproblems. %index:the index of the subproblem need to handle. %domain:the domain of the origional multiobjective problem. %ind:is an individual structure. neighbourindex=subproblems(index).neighbour; %The random draw from the neighbours. nsize=length(neighbourindex); si=ones(1,3)*index; si(1)=neighbourindex(ceil(rand*nsize)); while si(1)==index si(1)=neighbourindex(ceil(rand*nsize)); end si(2)=neighbourindex(ceil(rand*nsize)); while si(2)==index||si(2)==si(1) si(2)=neighbourindex(ceil(rand*nsize)); end si(3)=neighbourindex(ceil(rand*nsize)); while si(3)==index||si(3)==si(2)||si(3)==si(1) si(3)=neighbourindex(ceil(rand*nsize)); end %retrieve the individuals. points=[subproblems(si).curpoint]; selectpoints=[points.parameter]; oldpoint=subproblems(index).curpoint.parameter; parDim=size(domain,1); jrandom=ceil(rand*parDim); randomarray=rand(parDim,1); deselect=randomarray deselect(jrandom)=true; newpoint=selectpoints(:,1)+params.F*(selectpoints(:,2)-selectpoints(:,3)); newpoint(~deselect)=oldpoint(~deselect); %repair the new value. newpoint=max(newpoint,domain(:,1)); newpoint=min(newpoint,domain(:,2)); ind=struct('parameter',newpoint,'objective',[],'estimation',[]); %ind.parameter=newpoint; %ind=realmutate(ind,domain,1/parDim); ind=gaussian_mutate(ind,1/parDim,domain); %clear points selectpoints oldpoint randomarray deselect newpoint neighbourindex si; end get_structure function str=get_structure(name) %STRUCTURE Summary of this function goes here % %Structure used in this toolbox. % %individual structure: %parameter:the parameter space point of the individual.it's a column-wise %vector. %objective:the objective space point of the individual.it's column-wise %vector.It only have value after evaluate function is called upon the %individual. %estimation:Also a structure array of the individual.It's not used in %MOEA/D but used in MOEA/D/GP.For every objective,the field contains the %estimation from the GP model. % %estimation structure: %obj:the estimated mean. %std:the estimated standard deviation for the mean. % %subproblem structure: %weight:the decomposition weight for the subproblem. %optimal:the current optimal value of the current structure. %curpoiont:the current individual of the subproblem. %optpoint:the point that gain the optimal on the subproblem. % switch name case'individual' str=struct('parameter',[],'objective'[],'estimation'[]); case'subproblem' str=struct('weight',[],'optimal',[],'curpoint',[],'optpoint',[]); case'estimation' str=struct(); otherwise end init_weights function subp=init_weights(popsize,niche,objDim) %init_weights function initialize a pupulation of subproblems structure %with the generated decomposition weight and the neighbourhood %relationship. subp=[]; for i=0:popsize if objDim==2 p=struct('weight',[],'neighbour',[],'optimal',Inf,'optpoint',[],'curpoint',[]); weight=zeros(2,1); weight(1)=i/popsize; weight(2)=(popsize-i)/popsize; p.weight=weight; subp=[subp p]; elseif objDim==3 %TODO end end %weight=lhsdesign(popsize,objDim,'criterion','maximin','iterations',1000)'; %p=struct('weight',[],'neighbour',[],'optimal',Inf,'optpoint',[],'curpoint',[]); %subp=repmat(p,popsize,1); %cells=num2cell(weight); %[subp.weight]=cells{:}; %Set up the neighbourhood. leng=length(subp); distanceMatrix=zeros(leng,leng); for i=1:leng for j=i+1:leng A=subp(i).weight;B=subp(j).weight; distanceMatrix(i,j)=(A-B)'*(A-B); distanceMatrix(j,i)=distanceMatrix(i,j); end [s,sindex]=sort(distanceMatrix(i,:)); subp(i).neighbour=sindex(1:niche)'; end end moead function pareto=moead(mop,varargin) %MOEAD runs moea/d algorithms for the given mop. %Detailed explanation goes here %The mop must to be minimizing. %The parameters of the algorithms can be set through varargin.including %popsize:The subproblem's size. %niche:the neighboursize,must less then the popsize. %iteration:the total iteration of the moead algorithms before finish. %method:the decomposition method,the value can be'ws'or'ts'. starttime=clock; %global variable definition. global params idealpoint objDim parDim itrCounter; %set the random generator. rand('state',10); %Set the algorithms parameters. paramIn=varargin; [objDim,parDim,idealpoint,params,subproblems]=init(mop,paramIn); itrCounter=1; while~terminate(itrCounter) tic; subproblems=evolve(subproblems,mop,params); disp(sprintf('iteration%u finished,time used:%u',itrCounter,toc)); itrCounter=itrCounter+1; end %display the result. pareto=[subproblems.curpoint]; pp=[pareto.objective]; scatter(pp(1,:),pp(2,:)); disp(sprintf('total time used%u',etime(clock,starttime))); end function[objDim,parDim,idealp,params,subproblems]=init(mop, propertyArgIn) %Set up the initial setting for the MOEA/D. objDim=mop.od; parDim=mop.pd; idealp=ones(objDim,1)*inf; %the default values for the parameters. params.popsize=100;params.niche=30;params.iteration=100; params.dmethod='ts'; params.F=0.5; params.CR=0.5; %handle the parameters,mainly about the popsize while length(propertyArgIn)>=2 prop=propertyArgIn{1}; val=propertyArgIn{2}; propertyArgIn=propertyArgIn(3:end); switch prop case'popsize' params.popsize=val; case'niche' params.niche=val; case'iteration' params.iteration=val; case'method' params.dmethod=val; otherwise warning('moea doesnot support the given parameters name'); end end subproblems=init_weights(params.popsize,params.niche,objDim); params.popsize=length(subproblems); %initial the subproblem's initital state. inds=randompoint(mop,params.popsize); [V,INDS]=arrayfun(@evaluate,repmat(mop,size(inds)),inds, 'UniformOutput',0); v=cell2mat(V); idealp=min(idealp,min(v,[],2)); %indcells=mat2cell(INDS,1,ones(1,params.popsize)); [subproblems.curpoint]=INDS{:}; clear inds INDS V indcells; end function subproblems=evolve(subproblems,mop,params) global idealpoint; for i=1:length(subproblems) %new point generation using genetic operations,and evaluate it. ind=genetic_op(subproblems,i,mop.domain,params); [obj,ind]=evaluate(mop,ind); %update the idealpoint. idealpoint=min(idealpoint,obj); %update the neighbours. neighbourindex=subproblems(i).neighbour; subproblems(neighbourindex)=update(subproblems(neighbourindex),ind, idealpoint); %clear ind obj neighbourindex neighbours; clear ind obj neighbourindex; end end function subp=update(subp,ind,idealpoint) newobj=subobjective([subp.weight],ind.objective,idealpoint,'te'); oops=[subp.curpoint]; oldobj=subobjective([subp.weight],[oops.objective],idealpoint,'te'); C=newobj [subp(C).curpoint]=deal(ind); clear C newobj oops oldobj; end function y=terminate(itrcounter) global params; y=itrcounter>params.iteration; end randompoint function ind=randompoint(prob,n) %RANDOMNEW to generate n new point randomly from the mop problem given. if(nargin==1) n=1; end randarray=rand(prob.pd,n); lowend=prob.domain(:,1); span=prob.domain(:,2)-lowend; point=randarray.*(span(:,ones(1,n)))+lowend(:,ones(1,n)); cellpoints=num2cell(point,1); indiv=struct('parameter',[],'objective',[],'estimation',[]); ind=repmat(indiv,1,n); [ind.parameter]=cellpoints{:}; %estimation=struct('obj',NaN,'std',NaN); %[ind.estimation]=deal(repmat(estimation,prob.od,1)); end realmutate function ind=realmutate(ind,domains,rate) %REALMUTATE Summary of this function goes here %Detailed explanation goes here %double rnd,delta1,delta2,mut_pow,deltaq; %double y,yl,yu,val,xy; %double eta_m=id_mu; eta_m=20; numVariables=size(domains,1); if(isstruct(ind)) a=ind.parameter; else a=ind; end for j=1:numVariables if(rand()<=rate) y=a(j); yl=domains(j,1); yu=domains(j,2); delta1=(y-yl)/(yu-yl); delta2=(yu-y)/(yu-yl); rnd=rand(); mut_pow=1.0/(eta_m+1.0); if(rnd<=0.5) xy=1.0-delta1; val=2.0*rnd+(1.0-2.0*rnd)*(xy^(eta_m+1.0)); deltaq=(val^mut_pow)-1.0; else xy=1.0-delta2; val=2.0*(1.0-rnd)+2.0*(rnd-0.5)*(xy^(eta_m+1.0)); deltaq=1.0-(val^mut_pow); end y=y+deltaq*(yu-yl); if(y y=yl; end if(y>yu) y=yu; end a(j)=y; end end if isstruct(ind) ind.parameter=a; else ind=a; end end subobjective function obj=subobjective(weight,ind,idealpoint,method) %SUBOBJECTIVE function evaluate a point's objective with a given method of %decomposition. %Two method are implemented by far is Weighted-Sum and Tchebesheff. %weight:is the decomposition weight.(column wise vector). %ind:is the individual point(column wise vector). %idealpoint:the idealpoint for Tchebesheff decomposition. %method:is the decomposition method,the default is'te'when is %omitted. % %weight and ind can also be matrix.in which have two scenairos: %When weight is a matrix,then it's treated as a column wise set of %weights.in that case,if ind is a size1column vector,then the %subobjective is computed with every weight and the ind;if ind is also %a matrix of the same size as weight,then the subobjective is computed %in a column-to-column,with each column of weight computed against the %corresponding column of ind. %A row vector of subobjective is return in both case. if(nargin==2) obj=ws(weight,ind); elseif(nargin==3) obj=te(weight,ind,idealpoint); else if strcmp(method,'ws') obj=ws(weight,ind); elseif strcmp(method,'te') obj=te(weight,ind,idealpoint); else obj=te(weight,ind,idealpoint); end end end function obj=ws(weight,ind) obj=(weight'*ind)'; end function obj=te(weight,ind,idealpoint) s=size(weight,2); indsize=size(ind,2); weight((weight==0))=0.00001; if indsize==s part2=abs(ind-idealpoint(:,ones(1,indsize))); obj=max(weight.*part2); elseif indsize==1 part2=abs(ind-idealpoint); obj=max(weight.*part2(:,ones(1,s))); else error('individual size must be same as weight size,or equals1'); end end testmop function mop=testmop(testname,dimension) %Get test multi-objective problems from a given name. %The method get testing or benchmark problems for Multi-Objective %Optimization.The implemented problems included ZDT,OKA,KNO. %User get the corresponding test problem,which is an instance of class %mop,by passing the problem name and optional dimension parameters. mop=struct('name',[],'od',[],'pd',[],'domain',[],'func',[]); switch lower(testname) case'kno1' mop=kno1(mop); case'zdt1' mop=zdt1(mop,dimension); otherwise error('Undefined test problem name'); end end %KNO1function generator function p=kno1(p) https://www.wendangku.net/doc/4412093262.html,='KNO1'; p.od=2; p.pd=2; p.domain=[03;03]; p.func=@evaluate; %KNO1evaluation function. function y=evaluate(x) y=zeros(2,1); c=x(1)+x(2); f=9-(3*sin(2.5*c^0.5)+3*sin(4*c)+5*sin(2*c+2)); g=(pi/2.0)*(x(1)-x(2)+3.0)/6.0; y(1)=20-(f*cos(g)); y(2)=20-(f*sin(g)); end end %ZDT1function generator function p=zdt1(p,dim) https://www.wendangku.net/doc/4412093262.html,='ZDT1'; p.pd=dim; p.od=2; p.domain=[zeros(dim,1)ones(dim,1)]; p.func=@evaluate; %KNO1evaluation function. function y=evaluate(x) y=zeros(2,1); y(1)=x(1); su=sum(x)-x(1); g=1+9*su/(dim-1); y(2)=g*(1-sqrt(x(1)/g)); end end package src.day01; public class ACC { //父类,以下是共有属性和方法 //卡号 protected static long id; // 名字 protected static String name; // 身份证 protected static String personId; //电子邮件 protected static String email; // 密码 protected static long password; //余额 protected static double balance; public ACC(){ } public ACC(long id,String name,String personId,String email,long password,double balance ){ this.id = id; https://www.wendangku.net/doc/4412093262.html, = name; this.personId = personId; this.email = email; this.password = password; this.balance = balance; } // 存款方法 public static void deposit(double money){ balance += money; System.out.println("存款成功,你存入的金额为:" + money); } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { https://www.wendangku.net/doc/4412093262.html, = name; } public String getPersonId() { #include <> void print_star(void) { printf("*****************\n"); } void print_welcome(void) { printf("C language,welcome!\n"); } void main() { print_star(); print_welcome(); print_star(); getchar(); } 演示2 #include "" int sum(int i,int j) { return(i + j); } void main() { int n1,n2; printf("input 2 numbers:\n"); scanf("%d%d",&n1,&n2); printf("the sum = %d\n",sum(n1,n2)); getchar(); } 演示3 #include "" int maxnum(int,int,int); main() { int a,b,c; printf("Please enter 3 numbers:\n"); scanf("%d,%d,%d",&a,&b,&c); printf("Maxnum is %d\n",maxnum(a,b,c)); } int maxnum(int x,int y,int z) { int max=x; if(y>max) max = y; if(z>max) max = z; return max; } 演示4 #include <> int s1(int n) { int j,s; s=0; for(j=1;j<=n;j++) s=s+j; return s; } int sum(int n) { int i,s=0; for(i=1;i<=n;i++) s=s+s1(i); return s; } void main() { int n; printf("n:"); scanf("%d",&n); printf("s=%d\n",sum(n)); } 演示5 #include <> #include <> struct student { long int num; char name[20]; int age; char sex[4]; int e; char m[20]; char b[30]; char p[15]; }; int n=0; struct student stu[100]; struct student *p; void lr(); void ll(); void cx(); void xg(); void sc(); void bc(); void dq(); void px(); void main() { int z; printf("+---------------------------+\n"); printf("| 欢迎使用学生档案管理系统 |\n"); printf("+---------------------------+\n"); printf("提示:为保证您的操作得到保存,请按正常顺序退出系统^_^\n"); do { printf("\n\t\t\t--------------------------------\n"); printf("\t\t\t+ 主菜单 |\n"); printf("\t\t\t--------------------------------\n"); printf("\t\t\t+ [1]----录入学生信息 |\n"); printf("\t\t\t+ [2]----浏览学生信息 |\n"); printf("\t\t\t+ [3]----查询学生信息 |\n"); printf("\t\t\t+ [4]----删除学生信息 |\n"); printf("\t\t\t+ [5]----修改学生信息 |\n"); 有一个小型超市,出售N(N>=10)种商品,设计并实现一个系统,完成下列功能: 1.保存及输出。超市中的各种商品信息保存在指定文件中,可以把它们输出显示。 2.计算并排序。计算每类商品的总价值(sum,单精度)及平均价(aver,单精度,输出一位小数),将每类商品按平均价从大到小的顺序排序打印出来。 3.统计。统计输出库存量低于100的货号及类别。统计输出有两种以上(含两种)商品库存量低于100的商品类别。 1.2总体结构 本程序主要分为八个模块:主模块、信息输出修改模块、新建信息模块、排序模块、计算模块、统计模块1、统计模块2、打印模块。 1)主模块:通过调用各分模块实现功能; 2)信息输出修改模块:输出显示文件中商品信息内容,添加商品信息,删除商品信息,修改商品信息; 3)新建商品信息模块:建立一个新结构体,为链表存信息用,并且将信息保存在指定的文件中; 4)排序模块:把文件中顺序零乱的商品信息按单价的大小从高到低进行排序,放到链表里存储; 5)计算模块:将所有商品的价格与库存量进行累加求和; 6)打印模块:将商品信息按每类平均价格排序(从高到低)按顺序打印出来;7)统计模块1:统计库存量低于100的货名及类别; 8)统计模块2:统计商品库存量有2种以上(含2种)低于100的商品类别。附录(程序清单) #include "stdio.h" /*输入,输出头文件*/ #include "stdlib.h" /*申请空间头文件*/ #include "string.h" /*对字符串加工头文件*/ #include "conio.h" /*清屏头文件*/ FILE *fp; int n=0; /*定义文件指针类型*/ int i,j,a[4],m; /*定义整数类型*/ float aver[4],sum[4],g[4],h; /*定义浮点类型*/ char c[5]="elec"; /*定义字符数组类型*/ char d[5]="comm"; /*定义字符数组类型*/ char e[5]="food"; /*定义字符数组类型*/ char f[5]="offi"; /*定义字符数组类型*/ struct good /*定义结构体*/ { int num; /*商品编号*/ char name[20]; /*商品名称*/ char kind[40]; /*商品类型*/ float price; /*商品价格*/ char unit[10]; /*商品单位*/ int quantity; /*商品数量*/ struct good *next; /*定义结构体指针类型*/ }*head,*p1,*p2; struct good *createlist() /*创建链表函数*/ { struct good *head1,*p1,*p2; /*定义结构体指针类型*/ #include 超市管理系统完整+ 源代码 1 有一个小型超市,出售N(N>=10)种商品,设计并实现一个系统,完 成下列功能: 1.保存及输出。超市中的各种商品信息保存在指定文件中,能够把它们输出显示。 2.计算并排序。计算每类商品的总价值(sum,单精度)及平均价(aver,单精度,输出一位小数),将每类商品按平均价从大到小的顺序排序打印出来。 3.统计。统计输出库存量低于100的货号及类别。统计输出有 两种以上(含两种)商品库存量低于100的商品类别。 1.2总体结构 本程序主要分为八个模块:主模块、信息输出修改模块、新建信息模块、排序模块、计算模块、统计模块1、统计模块2、打印模块。 1) 主模块:经过调用各分模块实现功能; 2) 信息输出修改模块:输出显示文件中商品信息内容,添加商品信息,删除商品信息,修改商品信息; 2 3) 新建商品信息模块:建立一个新结构体,为链表存信息用,而且将信息保存在指定的文件中; 4) 排序模块:把文件中顺序零乱的商品信息按单价的大小从高到低进行排序,放到链表里存储; 5) 计算模块:将所有商品的价格与库存量进行累加求和; 6) 打印模块:将商品信息按每类平均价格排序(从高到低)按顺序打印出来; 7) 统计模块1:统计库存量低于100的货名及类别; 8) 统计模块2:统计商品库存量有2种以上(含2种)低于100的商品类别。 附录(程序清单) #include "stdio.h" /*输入,输出头文件*/ #include "stdlib.h" /*申请空间头文件*/ #include "string.h" /*对字符串加工头文件*/ #include "conio.h" /*清屏头文件*/ FILE *fp; 3 网上书店管理系统附程序源代码 数据库与管理信息系统 报告题目:网上书店管理系统 学院:信息工程与自动化学院 专业:计算机科学与技术 年级: 09级 学生姓名: 指导教师: 日期: -6-3 教务处制 目录 一、需求分析; ....................................................... 错误!未定义书签。 二、系统设计内容; ................................................ 错误!未定义书签。 三、系统逻辑设计; ................................................ 错误!未定义书签。 四、系统功能需求分析; ........................................ 错误!未定义书签。 五、总结;................................................................ 错误!未定义书签。 六、参考资料; ........................................................ 错误!未定义书签。 七、附录;................................................................ 错误!未定义书签。 一、需求分析; 网上书店系统主要是实现网上选书、购书、产生订单等功能的系统。一个典型的网上商城一般都需要实现商品信息的动态提示、购物车管理、客户信息注册登录管理、订单处理等模块。 根据网上书店的基本需求,本系统需要完成的具体任务如下: 1)书图查询: 当客户进入网上书店时,应该在主页面中分类显示最新的书目信息,以供客户选择所需图书,同时也应该提供按照图书名称,或者作者信息快速查询所需书目信息的功能。 2)购物车管理:当客户选择购买某图书产品时,应该能够将对应图书信息,如:价格、数量记录到对应的购物车中,并允许客户返回书目查询页面,选择其它商品,并添加到购物车中,当对应的购物订单生成后,应该能够自动清除以生成订单的购物车 #include"reg52.h" #define uchar unsigned char #define uint unsigned int sbit rs=P2^0; // lcd 控制端 sbit en=P2^2; // lcd 控制端 sbit all=P2^1; // lcd 控制端 sbit s0=P1^5; //时间调节 sbit s1=P1^6; sbit s2=P1^7; sbit voice=P2^7; int nt; sbit DQ=P2^6; sbit DS1302_CLK = P2^3; //实时时钟时钟线引脚sbit DS1302_IO = P2^4; //实时时钟数据线引脚sbit DS1302_RST = P2^5; //实时时钟复位线引脚sbit ACC0 = ACC^0; sbit ACC7 = ACC^7; unsigned char time; #define ads_y 0 #define ads_mo 3 #define ads_d 6 #define ads_w 9 #define ads_h 65 #define ads_m 68 #define ads_s 71 #define DS1302_SECOND 0x80 //写入ds地址宏定义 #define DS1302_MINUTE 0x82 #define DS1302_HOUR 0x84 #define DS1302_WEEK 0x8A #define DS1302_DAY0x86 #define DS1302_MONTH 0x88 #define DS1302_YEAR 0x8C 演示1 #include return 0; } int maxnum(int x,int y,int z) { int max=x; if(y>max) max = y; if(z>max) max = z; return max; } 演示4 #include #include<> #include<> #include<> typedef struct Student{ char name[20]; char sex[5]; int age; char institute[20]; char specialty[30]; }Student; typedef struct Room{ int roomnum; int roomarea; int totalnum; int stunum; Student stu[10]; Room *next; }Room; typedef struct Story{ char storynum; Room *room; }Story; /*-------------------------------------------------------------------------------------------------*/ Student *StudentCreat(int age,char name[],char institute[],char specialty[],char sex[]) { Student *Stu; Stu=(Student *)malloc(sizeof(Student)); Stu->age=age; strcpy(Stu->institute,institute); strcpy(Stu->name,name); strcpy(Stu->specialty,specialty); strcpy(Stu->sex,sex); return Stu; } Room *RoomCreat(int room_num,int room_area,int total_num,int stu_num) { Room *R; int i; R=(Room *)malloc(sizeof(Room)); 简易水电费管理系统源程序代码 法一: #include 学生管理系统程序源代码-标准化文件发布号:(9556-EUATWK-MWUB-WUNN-INNUL-DDQTY-KII #include 专业设计报告 课程名称: C 语言程序设计 课题名称: 医院信息管理系统 专业班别: 12本计算机科学与技术二班姓名: 学号: 指导教师: 设计日期: -5-25 教师评语: 成绩评定: 指导教师签名: 日期: 年月日 课程设计题目医院信息管理程序 作者姓名: 同组成员: 摘要利用结构体存储每个病人的信息和每种药品的信息, 并使用链表存储全部病人的信息; 能完成对医院内所有病人信息的注册、查询、删除和修改等操作, 同时又能对药房内库存的药品进行查询; 能够将链表中的病人信息保存在文件中, 而且能够对文件中的病人信息进行读取与显示1.专业设计目的 1、掌握链表的操作, 包括链表节点的创立、释放还有链表的遍历 2、掌握对二进制文件的创立、增添等基本操作。 3、熟悉C语言函数的使用方法, 学会模块化处理问题以及多个源文件的处理方式 2.设计基本要求( 1、使用结构体来存储病人的信息, 结构体中包括病的id号码、姓名、病历以及消费信息, 并用链表将所有病人信息整合。 2、用文件来存储链表的信息以便下次再使用该程序时载入病人信息 3、能够实现病人信息的注册、病人信息的查询、病人消费统计、保存链表信息、载入链表信息、查询库存等几项功能。 4、要求用四个源文件main.c、link.c、find.c、save_load.c 5、系统完成后应实现类似下面所示界面 3、算法分析 1、数据结构 设计链表中的一个节点存储一个病人的信息, 使用下面的结构体类型定义: struct patient{ char id[10]; char name[10]; char casehist[200]; int cost[3]; int transfusion; int surgery; struct patient *next; }; 面 向 对 象 程 序 设 计 大 作 业 姓名:叶尔凯西 学院(系):计科系 班级:计科系07-1 班 学号: 027 设计本程序的目的: 关于一些并不太复杂的集体来说,一般需要管理集体中的每个人的基本信息的,本程序 专门为一些在校学生的基本信息的管理而设计的,主要目的是通过本程序来实现简单的记录和 查找学生的基本信息; 程序功能简介: 本程序是通过面向对象的最重要的特点“类”来设计出来的,其功能是实现简单的学生基 本信息管理。包括一些要求用户从键盘输入(记录)学生的基本信息、输出学生的基本信息和用 学生的学号来查找学生信息表中的某个学生的基本信息等功能; 程序功能的详细介绍: 本人设计程序时考虑到的很所内容,其中输入输出学生的基本信息是最基本的功能。下面来给大家介绍程序的核心类的构建: ①在程序中共建立了两种类,分别是person 类和 student类。person作为student 类的基类,其内部是如下设计的: class person { public: void SetPersonAddress(char *AddressFromMain); void SetPersonSex(char *SexFromMain); void ShowPersonSex(); void ShowPersonAddress(); private: char Address[25]; char Sex[2]; }; 可以看到,在上面分别声明了四个成员函数和两个数据成员。四个成员函数的作用是对私有数据成员进行访问(包括输入和输出)。所以当建立了一个 person 类之后 就可以通过它的对象来访问该类的数据成员。 下面分别说明每一个成员函数的具体定义: ( 1)设置(输入)人地址的成员函数: void person::SetPersonAddress(char *AddressFromMain) { strcpy(Address,AddressFromMain); } 通过 strcpy把字符指针的内容送入person 类中的数据成员Address 。 ( 2)设置(输入)人性别的成员函数: void person::SetPersonSex(char *SexFromMain) { strcpy(Sex,SexFromMain); } 经典C语言程序设计100例 1.数字排列 2.奖金分配问题 3.已知条件求解整数 4.输入日期判断第几天 5.输入整数进行排序 6.用*号显示字母C的图案 7.显示特殊图案 8.打印九九口诀 9.输出国际象棋棋盘 10.打印楼梯并按条件打印笑脸 11.经典兔子问题 12.判断素数 13.水仙花数问题 14.正整数分解质因数 15.学习成绩划分 16.正整数求其最大公约数和最小公倍数 17.统计英文字母/空格/数字个数 18.求s=a+aa+aaa+aa...a的值 19.求解"完数" 20.球体自由落下物理问题 21.猴子吃桃问题 22.乒乓球比赛抽签问题 23.打印菱形图案 24.分数数列求和 25.求1+2!+3!+...+20!的和26.利用递归方法求5! 27.将输入字符以相反顺序打印 28.岁数问题 29.求解正整数位数 30.判断回文数 31.星期几猜测游戏 32.改变文本颜色 33.学习gotoxy()与clrscr()函数34.练习函数调用 35.设置文本颜色 36.求100之内的素数37.对10个数进行排序 38.求3*3矩阵对角线元素之和 39.数字插入数组重新排序40. 将一个数组逆序输出 定义静态变量用法42.使用auto 定义变量用法43.使用static 的另一用法 44.使用external的用法 45.使用register定义变量方法 46.宏#define命令练习(1) 47.宏#define命令练习(2) 48.宏#define命令练习(3) 49.#if #ifdef和#ifndef的综 合应用 50.#include 的应用练习 51.学习使用按位与 & 52.学习使用按位或 | 53.学习使用按位异或 ^ 54.取一个整数从右端开始的 4~7位。 55.学习使用按位取反~ 56.用circle画圆形 57.学用line画直线 58.用rectangle画方形 59.画图综合例子1 60.画图综合例子2 61.打印杨辉三角形 62.学习putpixel画点 63.画椭圆ellipse 64.利用ellipse and rectangle 画图 65.画个最优美的图案 66.输入3个数字按大小顺序输 出 67.输入数组交换元素重新输出 68.多个整数后移位置问题 69.圆圈报数问题 70.计算一个字符串长度 71.编写输入/输出函数 72.创建链表 73.反向输出链表 74.连接两个链表 75.算一道简单题目 76.调用函数求 1/2+1/4+...+1/n 77.填空练习(指向指针的指针) 78.找到年龄最大的人 79.字符串排序 80.海滩猴子分桃 81.已知公式条件求数字 82.八进制转换为十进制 83.求0-7所能组成的奇数个数 84.由两个素数之和表示的偶数 85.判断一个素数能被几个9整 除 86.两个字符串连接程序 87.结构体变量传递 88.读取数字的整数值并打印出 该值个数的* 89.数据加密 90.专升本一题 91.时间函数举例1 92.时间函数举例2 93.时间函数举例3 94.一个猜数游戏 95.家庭财务管理小程序 96.计算字符串中子串出现的次 数 97.输入字符并保存到磁盘98. 字符串转换成大写字母并输出 保存 99.文件操作应用1 100.文件操作应用2 -------------------------------------------------------------------------------- c语言经典100题【实用】 源程序 1.主窗体 Private Sub add_back_Click() frmbackbookinfo.Show End Sub Private Sub add_binf_Click() frmaddbookinfo.Show End Sub Private Sub add_book_style_Click() frmaddbookstyle.Show End Sub Private Sub add_manager_Click() frmadduser.Show End Sub Private Sub add_rinf_Click() frmaddreaderinfo.Show End Sub Private Sub add_rstyle_Click() frmaddreaderstyle.Show End Sub Private Sub change_binf_Click() frmmodifybookinfo.Show End Sub Private Sub change_book_style_Click() frmmodifybookstyle.Show End Sub Private Sub delete_binf_Click() frmmodifybookinfo.Show End Sub Private Sub delete_book_style_Click() frmmodifybookstyle.Show End Sub Private Sub delete_rstyle_Click() frmmodifyreaderstyle.Show End Sub Private Sub exit_Click() End End Sub Private Sub find_binf_Click() frmfindbook.Show End Sub Private Sub find_lend_Click() frmfindborrowinfo.Show 学生信息管理系统源代码 #include 辽宁工业大学 JA V A程序设计课程设计(论文)题目: JAVA简单记事本程序 院(系):软件学院 专业班级:软件工程班 学号: 学生姓名: 指导教师: 教师职称: 起止时间: 程序设计专题(报告)任务及评语 目录 第1章课程设计的目的与要求 (4) 1.1 课程设计目的 (4) 1.2 课程设计的实验环境 (4) 1.3 课程设计的预备知识 (4) 1.4 课程设计要求 (4) 第2章课程设计内容 (5) 2.1课题描述 (5) 2.2 系统设计 (5) 2.2.1功能分析 (5) 2.2.2面向对象设计 (5) 2.2.3详细设计 (7) 2.3程序实现 (10) 2.3.1源码分析 (10) 2.3.1运行结果 (14) 第3章总结 (18) 参考文献19 第1章课程设计的目的与要求 1.1 课程设计目的 《JA V A程序设计》是计算机相关专业的必修专业基础课程,其实践性、应用性很强。实践教学环节是必不可少的一个重要环节。本课程的程序设计专题实际是计算机相关专业学生学习完《JAVA程序设计》课程后,进行的一次全面的综合训练,JA V A程序设计的设计目的是加深对理论教学内容的理解和掌握,使学生较系统地掌握程序设计及其在网络开发中的广泛应用,基本方法及技巧,为学生综合运用所学知识,利用软件工程为基础进行软件开发、并在实践应用方面打下一定基础。 1.2 课程设计的实验环境 硬件要求能运行Windows 9.X操作系统的微机系统。JAVA程序设计语言及相应的集成开发环境,J2SDK和ECLIPSE开发工具。 1.3 课程设计的预备知识 熟悉JAVA语言及ECLIPSE开发工具。 1.4 课程设计要求 按课程设计指导书提供的课题,要求学生在自行完成各个操作环节,并能实现且达到举一反三的目的,完成一个项目解决一类问题。要求学生能够全面、深入理解和熟练掌握所学内容,并能够用其分析、设计和解答类似问题;对此能够较好地理解和掌握,能够进行简单分析和判断;能编写出具有良好风格的程序;掌握JA V A程序设计的基本技能和面向对象的概念和方法;了解多线程、安全和网络等编程技术。同时培养学生进行分析问题、解决问题的能力;培养学生进行设计分析、设计方法、设计操作与测试、设计过程的观察、理解和归纳能力的提高。 附程序源代码: program xmjl; uses Forms, windows, main in 'main.pas' {Form1}, dm in 'dm.pas' {dm2: TDataModule}, about in 'about.pas' {AboutBox}, report in 'report.pas' {qr1: TQuickRep}, logosrc in 'logosrc.pas' {logo}, login in 'login.pas' {denglu}; {$R *.res} begin Application.Initialize; logo:=tlogo.Create(application); logo.Show; logo.Update; Application.CreateForm(Tdm2, dm2); Application.CreateForm(Tdenglu, denglu); sleep(1000); logo.Hide; logo.Free; Application.Run; end. unit logosrc; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, jpeg, ExtCtrls; type Tlogo = class(TForm) Image1: TImage; private { Private declarations } public { Public declarations } end; var logo: Tlogo; implementation {$R *.dfm} end. unit login; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Mask, Buttons; type Tdenglu = class(TForm) BitBtn1: TBitBtn; BitBtn2: TBitBtn; ComboBox1: TComboBox; MaskEdit1: TMaskEdit; Label1: TLabel; Label2: TLabel; procedure BitBtn2Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure BitBtn1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var denglu: Tdenglu; implementation uses dm,main; {$R *.dfm}软件工程-银行储蓄管理系统源代码
C语言程序设计 入门源代码代码集合
学生管理系统程序源代码
超市管理系统完整+源代码
客户端程序源代码
超市管理系统完整+源代码
网上书店管理系统附程序源代码
数字万年历简易C语言程序源代码
C语言程序设计-入门源代码代码集合
宿舍管理系统源代码
简易水电费管理系统源程序代码
学生管理系统程序源代码
C语言程序设计医院信息管理系统附源代码样本
C程序设计大作业(含源代码).doc
语言程序设计个简单的经典例子
图书管理系统程序源代码
学生信息管理系统源代码
JAVA简单记事本程序(源代码)课程设计
财务管理系统附程序源代码