云南大学软件学院实验报告

合集下载

云南大学--软件学院--数据库实验4

云南大学--软件学院--数据库实验4

云南大学软件学院实验报告课程:数据库原理与实用技术实验学期: 2012-2013学年第二学期任课教师:专业:学号:姓名:成绩:实验4 数据查询一、实验目的理解T-SQL语言的使用;熟练掌握数据查询语句;掌握合计函数的使用。

二、实验内容1、CAP数据库的查询(记录每个查询的SQL语句和查询结果)(1)建立CAP数据库,输入C、A、P、O四张表;图表 1 创建cap数据库图表 2创建四个表图表 3向表中插入数据图表 4表的内容(2)完成课后习题[3.2]b、[3.5]、[3.8]a,b、[3.11]b,f,j,l[3.2] (b)Retrieve aid values of agents who receive the maximum percent commission.图表 5最高佣金百分率[3.5] Consider the problem to find all (cid, aid) pairs where the customer does not place an order through the agent. This can be accomplished with the Select statementselect cid, aidfrom customers c. agents awhere not exists(select * from orders x where x.cid = c.cid and x.aid =a.aid) ;Is it possible to achieve this result using the NOT IN predicate in place of the NOT EXISTS predicate with a single Subquery? With more than one Subquery? Explain your answer and demonstrate any equivalent form by execution.图表 6 3.5 not in[3.8](a) Write a Select statement with no WHERE clause to retrieve all customer cids and the maximum money each spends on any product. Label the columns of the resulting table: eid, MAXSPENT.图表 7 3.8(b) Write a query to retrieve the AVERAGE value (over all customers) of the MAXSPENT of query (a)图表 8 3.8(b)[3.11] (b) We say that a customer x orders a product y in an average quantity A if A is avg(qty) for all orders rows with cid = x and pid = y. Is it possible in a single SQL statement to retrieve cid values of customers who order all the products that they receive in average quantities (by product) of at least 300?图表 9 3.11 (b)(f) Get pid values of products that are ordered by all customers in Dallas.图表 10 3.11 (f)(j) Use a single Update statement to raise the prices of all products warehoused in Duluth or Dallas by 10%. Then restore the original values byrerunning the procedure that you originally used to create and load the products table.图表 11 3.11 (j)(l) Write an SQL query to get aid and percent values of agents who take orders from all customers who live in Duluth. The aid values should be reported in order by decreasing percent. (Note that if percent is not retrieved in the select list, we cannot order by these values.)图表 12 3.11 (i)2、Employee数据库的查询(记录每个查询的SQL语句和查询结果)(1)向表中插入数据。

云南大学软件学院数据结构实验二实验报告——多项式计算器

云南大学软件学院数据结构实验二实验报告——多项式计算器

云南大学软件学院数据结构实验报告2010秋季学期(本实验项目方案受“教育部人才培养模式创新实验区(X3108005)”项目资助)学号:姓名:专业:指导老师:实验难度A□B□ C □承担任务(难度为C时填写)指导教师评分(签名)【实验题目】实验2. 线性表及其应用【问题描述】用C或C++语言设计并实现一个一元稀疏多项式的简单计算器。

【基本要求】一元稀疏多项式简单计算器的基本功能是:1、输入并建立多项式2、输出多项式,序列按指数降序排列3、多项式A(x)和B(x)相加,并建立多项式A(x)+B(x)4、多项式A(x)和B(x)相减,并建立多项式A(x)-B(x)5、给定 x 的值,计算多项式6、多项式A(x)和B(x)相乘,建立多项式A(x)*B(x) (* 选做,作为难度B的操作)【CDIO项目要求】1、有完整的CDIO四个阶段描述2、有友好美观的操作界面3、有软件使用说明或帮助文档4、项目成员分工明确,团结协作【实现提示】一、【实验构思(Conceive)】(10%)本实验通过C语言实现了多项式加法、减法、乘法、多项式求导、多项式积分的功能。

利用了冒泡排序的算法作为排序的核心算法。

运用了高等数学中多项式的求导积分的知识。

二、【实验设计(Design)】(15%)本程序定义了抽象数据结构listnode,用于存储多项式的系数和指数并存储指向下一个listnode的指针来构成链表。

本程序包含如下*个函数:Main函数:调用input函数—>调用bubble_sort函数—>调用operplus函数—>调用oper_minus函数—>调用oper_mul函数—>调用oper_dy函数—>调用oper_jifen 函数。

Oper_plus函数:将两个链表的相应项系数相加,指数不同项不操作,存入新链表,再调用排序算法,使之为降序排列。

Oper_minus函数:将两个链表的相应项系数相减,指数不同项不操作,存入新链表,再调用排序算法,使之为降序排列。

云南大学软件学院报告

云南大学软件学院报告

课程:数据结构实验学期:2014-2015学年第一学期任课教师:专业:信息安全学号:姓名:成绩:实验5 图基础实验一、实验目的1.掌握图的存储结构及其遍历。

二、实验软硬件环境(CPU、OS、IDE):三、实验任务(要求写出核心代码,并对运行结果截图)1)使用邻接矩阵和邻接表储表示分别实现如下给定的图1、图2、图3所示图的物理存储结构。

2)在1)所建立的图形存储结构上分别实现深度优先搜索遍历和广度优先搜索遍历,并给出遍历结果(序列)。

图3 有向图实验代码:#include<stdio.h>#include<stdlib.h>#define MAXVEX 20#define OK 1#define ERROR 0#define OVERFLOW -1#define INFINITY 65535#define QueueSize 20 //队列中最大元素个数typedef int QElemType; //队列的元素的类型typedef int VertexType;typedef int EdgeType;typedef enum{False,True}Boolean; //Boolean是布尔类型,其值是ture或false Boolean visited[MAXVEX]; //访问标志的数组。

typedef struct{VertexType vexs[MAXVEX];EdgeType arc[MAXVEX][MAXVEX];int numVertexes,numEdges;} MGraph; //邻接矩阵。

typedef struct EdgeNode //边表结点。

{int adjvex;struct EdgeNode *next;}EdgeNode;typedef struct VertexNode //顶点表结点。

{int data;EdgeNode *firstedge;}VertexNode,AdjList[MAXVEX];typedef struct{AdjList adjlist;int numVertexes,numEdges; //图中当前顶点数边数。

云南大学 软件学院 数据库实验3

云南大学  软件学院  数据库实验3

云南大学软件学院实验报告课程:数据库原理与实用技术实验学期:2011-2012学年第二学期任课教师:专业:学号:姓名:成绩:实验3使用SQL语句创建并管理数据库、数据表一、实验目的掌握查询分析器的使用方法。

掌握T-SQL语句的基本使用。

熟练掌握DDL语句。

熟练掌握DML(Insert, Delete, Update)语句。

二、实验内容1、用T-SQL语句创建并管理数据库“Employee数据库”,数据库要求见实验二。

记录创建数据库的SQL语句。

2、修改数据库:将“Employee数据库”的数据库最大容量更改为无限制(UNLIMITED),然后将“Employee数据库”的日志文件增长方式改为2MB。

记录SQL语句。

3、用T-SQL语句在“Employee数据库”创建数据表,数据表的结构见实验二。

记录创建表的SQL 语句。

4、修改表结构:将雇员信息表person中,Prof的字段长度改为15。

记录SQL语句。

5、向表中添加记录,使用Insert Into 语句分别向四张表中添加符合表结构属性的数据记录,要求每张表至少4条记录,并显示所添加的记录数据。

6、向雇员信息表person中添加记录完成如下操作:(1)、修改表中记录:将“王辉”的部门修改为“003”;(2)、删除记录:删除表中性别为“女”的员工记录;(3)、删除表:将“person”从“Employee数据库”中删除。

三、思考题如数据库表中存在如下记录:表person中的数据现执行:DELETE FROM department WHERE Depton=“001”,执行结果如何?为什么?。

云南大学软件学院综合技能实践-常用数据库的安装与调试实验报告模板

云南大学软件学院综合技能实践-常用数据库的安装与调试实验报告模板

云南大学软件学院实验报告课程:综合技能实践2——常用数据库的安装与调试学期: 2015秋季学期任课教师:朱艳萍金鑫专业:软件工程学号:姓名:成绩:综合技能实践2——常用数据库的安装与调试第一部分MySQL数据库的安装和使用一、实验目的:1.掌握MySQL数据库环境搭建的具体步骤和操作方法。

2.掌握启动和运行MySQL的方法。

3.掌握使用SQL语句创建数据库、表及向表中插入记录的方法。

二、实验内容和步骤1、首先,查看本台机器的C盘根目录下是否有mysql的文件夹,如果没有,请到(FTP服务器上) 下载mysql-4.0.20a-win.zip或者mysql-5.1.51-win32文件,解压后进行安装。

2、进入安装目录,然后切换到bin文件夹下,双击运行命令mysqld.exe:3、打开命令窗口,然后切换到C:\mysql\bin文件夹下,并输入如下命令:C:\mysql\bin>mysql -u root -p回车后出现Enter password: 提示信息,继续敲入回车符,就进入到MySQL的工作界面:mysql>。

成功地连接后,可以在mysql>提示下输入QUIT (或\q)随时退出:mysql> QUITBye3、在mysql>提示符输入select version(), current_date();命令,系统将显示什么信息?4、下面,在mysql>提示下输入命令SHOW DATABASES; 系统将显示什么信息?(该命令用来显示MySQL中已创建的数据库名称)5、在mysql>提示下输入命令use test; ,系统给出提示信息Database changed,表示已经转到数据库test中。

6、在mysql>提示下输入命令show tables; ,系统给出的提示信息是什么?7、下面,将创建我们实验用的数据库、表和表中的记录。

数据库名称:stud+自己学号的最后4位,如:stud1011。

实验报告模板—汇编语言

实验报告模板—汇编语言

指导教师 (签名):一.实验原理(基本知识简单介绍、算法、流程)二.实验结果(截图,提供实验测试/调试的结果等,在空白地方手写注释)Student strucm_sName db 6 dup(' ')m_sNum db 8 dup(' ')m_sScore db 3 dup(' ')Student endsstsg segment stack 's'dw 32 dup(?)stsg endsanykey macromov ah,7int 21hendmanykeyback macroanykeyshowmsg backendmcrlfm macropush axpush dxmov ah,9lea dx,crlfint 21hpop dxpop axendmexchange macro i,jpush cxpush sipush dimov cx,17;t=[i],即t=前项mov si,ilea di,stutemprep movsbmov cx,17;i=j,si->后项,即前项=后项mov di,i ;rep movsbmov cx,17;j=t,di->后项,即后项=tlea si,stutemprep movsbmov swapped,1pop dipop sipop cxendmspace macropush dxpush axlea dx,gapmov ah,9int 21hpop axpop dxendmshowmsg macro npush axpush dxmov ah,9lea dx,msg&nint 21hpop dxpop axendmmovitem macro dst,srcpush cxpush dipush sicldmov cx,17lea di,[dst]lea si,[src]rep movsbpop sipop dipop cxendmdata segmentstudentx student 30 dup(<>)stutemp db 17 dup (0),'$'studisp db 19 dup(0),'$'namepar LABEL BYTEmaxnlen db 7namelen db ?namefld db 7 dup(?)numpar label bytemaxmlen db 9numlen db ?numfld db 9 dup(?)scopar label bytemaxsco db 4scolen db ?scofld db 4 dup(?);输入文件路径缓冲区pathpar label bytepathmax db 40pathlen db ?pathnam db 40 dup(?)ae90 db 0ae80 db 0ae70 db 0ae60 db 0b60 db 0msg_b60 db 9,9,'Scores<60:$'msg_ae60 db 9,9,'Scores>=60:$'msg_ae70 db 9,9,'Scores>=70:$'msg_ae80 db 9,9,'Scores>=80:$'msg_ae90 db 9,9,'Scores>=90:$'cur_i dw ?crlf db 13,10,'$'titl db ' Students Management System',0DH,0AH,' ',0DH,0AH,0DH,0AHmenu1 db ' I(Insert the data of the students)',0dh,0ah ;menumenu2 db ' L(Browse the data of the students)',0dh, 0ahmenu3 db ' Q(Query the data of the students)',0dh, 0ahmenu4 db ' D(Delete the data of the students)',0dh, 0ahmenu5 db ' M(Modify the data of the students)',0dh,0ahmenu7 db ' P(Print the data of the students)',0dh, 0ahmenu8 db ' C(Statistics the data of the students)',0dh, 0ahmenu9 db ' E(Exit the System)',0dh, 0ah,'$'msgmenu5_1 db 0DH,0AH,'1-----Modify name',0DH,0AHmsgmenu5_2 db '2-----Modify number',0DH,0AHmsgmenu5_3 db '3-----Modify score',0DH,0AH,'$'msgmenu3_1 db 0DH,0AH,'1-----Search name',0DH,0AHmsgmenu3_2 db '2-----Search number',0DH,0AHmsgmenu3_3 db '3-----Search score',0DH,0AH,'$'mmenutip db ' choose a number from the menu above',0DH,0AH,'$'msgprinttitle db 0DH,0AH,0DH,0AH,' sno sname score ',0DH,0AH,'$'gap db ' $'stu dw ?stustored dw 0swapped db 0sav_cnt dw ?stusaved dw 0saveflag db 1errcde db 0endcde db 0endaddr dw ?filehandle dw ?msg_titleln db ' ------------------------------------',13,10,'$'msgsepln db '--------------------------------',0DH,0AH,'$'msg02 db 'Please input the new student info.',13,10,'$'msg03 db 'Name:','$'msg04 db 'ID:','$'msg05 db 'Score:','$'msg07 db 'Successly Saved!',13,10,'$'msgdeled db 'Successly Deleted a item!',13,10,'$'msgmoded db 'Successly Modified a item content!',13,10,'$'msginsed db 'Successly Inserted item(s)!',13,10,'$'msgqforins db 'Insert this item?(y/n):',13,10,'$'msgback db 'Press any key to back.$'msgexit db 'Press any key to exit.$'msg09 db 'students out of 30.',13,10,'$'msg20 db 'There are more than 30 students.',13,10,'$'msg21 db 'Save as:',13,10,'$'msg22 db 'Please input the file you want to operate:',13,10,'$'msg23 db 'Read successly!',13,10,'$'msg27 db 'There isn',27h,'t any student.',13,10,'$'msgnoext db 'There is no such item!',13,10,'$'msgnaminfid db 'Please input a name to find:',13,10,'$'msgnuminfid db 'Please input a number to find:',13,10,'$'msgscoinfid db 'Please input a score to find:',13,10,'$'msgstattit db 9,9,'The result of statistics is listed as follow:',13,10,'$'msg_nname db 'Please input a new one:',13,10,'$'msg_nnum db 'Please input a new num.:','$'msg_nsco db 'Please input a new score.:','$'msgqsave db 'The ducoment have not saved.Do you want to save it now(y/n)?','$'msg_delnamin db 'Please input the name you want to delete:',13,10,'$'msg_modname db 'Please input the name field you want to modify:',13,10,'$' msg_modnum db 'Please input the number field you want to modify:',13,10,'$'msg_modsco db 'Please input the score field you want to modify:',13,10,'$' opnmsg db '***Error occured while opening file***',13,10,'$' wrtmsg db '***Error occured while writing file***',13,10,'$' readmsg db '***Error occured while reading file***',13,10,'$' routemsg db '***Path name is invalid***',13,10,'$'data endscode segmentassume cs:code,ds:data,ss:stsg,es:datamain proc farstart:mov ax,datamov ds,axmov es,axmainmenu:mov AX,0600Hmov CX,0000Hmov DX,174FHmov BH,07int 10Hmov AH,02 ;set cursormov BH,0mov DX,0100Hint 10Hlea DX,titl ;display menumov AH,9int 21Hshowmsg _titlelnlea DX,mmenutipmov AH,9int 21Hcase:mov ah,0int 16hcmp ah,17h;'i'je addonecmp ah,26h;'l'je browsecmp ah,19h;'p'je displaycmp ah,10h;'q'je querycmp ah,20h;'d'je del_intermcmp ah,2eh;'c'je statiscmp ah,32h;'m'je changecmp ah,12h;'e'je exitdisplay:call display_inanykeybackjmp mainmenuquery:call query_inanykeybackjmp mainmenubrowse:call browse_inanykeybackjmp mainmenuaddone:call insert_inanykeybackjmp mainmenuexit:call quitstatis:call stat_inanykeybackjmp mainmenudel_interm:jmp deletechange:call mod_inanykeybackjmp mainmenudelete:call del_inanykeybackjmp mainmenubeep:mov AH,14mov AL,7mov BH,0int 10Hjmp mainmenumain endp;------------------------------------------------------------------------ browse_in proc nearcall near ptr clearcall near ptr cursorcall near ptr readallcall name_sortcall near ptr printretbrowse_in endp;------------------------------------------------------------------------ del_in proc nearcall clearcall cursorcall delete_inretdel_in endp;------------------------------------------------------------------------ query_in proc nearcall clearcall cursorcall bg_searchretquery_in endp;------------------------------------------------------------------------ stat_in proc nearcall clearcall cursorcall near ptr statretstat_in endp;------------------------------------------------------------------------ insert_in proc nearcall clearcall cursorcall near ptr inputcall name_sortretinsert_in endp;------------------------------------------------------------------------ display_in proc nearcall clearcall cursorcall near ptr printretdisplay_in endp;------------------------------------------------------------------------ mod_in proc nearcall clearcall cursorcall printcall bg_modifycall name_sortretmod_in endp;------------------------------------------------------------------------ delete_in proc nearpush axpush dxcall printcrlfmmov ah,9lea dx,msg_delnaminint 21hcall near ptr inputnamecall near ptr delshowmsg deledqdel:pop dxpop axretdelete_in endp;------------------------------------------------------------------------ bg_search proc nearshowmsg menu3_1mov ah,1int 21h;getch()crlfmcmp al,'1'je q1cmp al,'2'je q2showmsg scoinfidlea bx,studentx+14mov dx,3jmp bgsearq1:showmsg naminfidcall near ptr inputnamelea bx,studentxmov dx,1jmp bgsearq2:showmsg numinfidcall near ptr inputnumlea bx,studentx+6mov dx,2bgsear:push bxpush dxcall near ptr search;search(studentx,1)cmp ax,-1je qinsshowmsg printtitleshowmsg seplnpush simov si,axcall near ptr printlinepop sijmp qqueqins:showmsg qforinsmov ah,01int 21hcrlfmcall inputnumcall inputscocall storshowmsg insedmov saveflag,0qque:retbg_search endp;------------------------------------------------------------------------ bg_modify proc nearpush axpush bxpush dxshowmsg menu5_1;display modify submenumov ah,1int 21h;getch()crlfmcmp al,'1'je t1cmp al,'2'je t2mov bx,3call inputscojmp cint1:call inputnamemov bx,1jmp cint2:mov bx,2call inputnumcin:push bxcall near ptr modifycmp ax,-1je qmodicrlfmshowmsg modedqmodi:pop dxpop bxpop axretbg_modify endp;------------------------------------------------------------------------ quit proc nearcmp saveflag,0je qforsavjmp qsysqforsav:call clearcall cursorshowmsg qsavemov ah,1int 21hcmp al,'y'je savitjmp qsyssavit:call savemov ah,3eh;close filemov bx,filehandleint 21hqsys:mov ax,4c00hint 21hretquit endp;------------------------------------------------------------------------ search proc nearpush bpmov bp,sppush dipush bxpush sipush cxpush dxmov di,[bp+6]mov dx,stustoredmov bx,[bp+4];bx:typemov bp,dicmp bx,1je snamcmp bx,2je snummov cx,3mov bx,cxlea ax,scofldjmp loop1snam:mov cx,6mov bx,cxlea ax,namefldjmp loop1snum:mov cx,8mov bx,cxlea ax,numfldloop1:mov si,axrepe cmpsbje foundadd bp,17mov di,bpdec dhjnz loop1mov ax,-1showmsg noextjmp qsearchfound:mov ax,bpmov dx,stustoredsub dx,bxmov cur_i,dxqsearch:pop dxpop cxpop sipop bxpop dipop bpret 4search endp;------------------------------------------------------------------------ name_sort proc nearpush sipush dipush axpush bxpush dxpush cxcmp stustored,1je qsortlea bx,studentxpush bxmov ax,stustoredsub ax,1mov bl,17mul blpop bxadd bx,axmov dx,stustoredsub dx,1 ;dx:il1:mov swapped,0sub bx,17mov endaddr,bxpush bxlea si,studentx;si:j,j=0l2:mov di,siadd di,17mov bx,dimov ax,sirepe cmpsbjbe s3exchange ax,bxs3:mov si,axadd si,17;j++cmp si,endaddrjbe l2pop bxcmp swapped,0je qsortdec dxjnz l1qsort:pop cxpop dxpop bxpop axpop dipop siretname_sort endp;------------------------------------------------------------------------ del proc nearpush bxpush dipush sipush cxlea bx,studentxpush bxmov bx,1;search(studentx,name)push bxcall near ptr searchcmp ax,-1je nomatchmov di,axmov si,diadd si,17;si:j,di:imov cx,stustoredsub cx,cur_imovit:movitem di,simov di,si;si:j+1 ,di:jmov dx,diadd dx,17mov si,dxloop movitmov ax,1mov saveflag,0sub stustored,1nomatch:pop cxpop sipop dipop bxretdel endp;------------------------------------------------------------------------ insert proc nearpush sipush dipush axpush bxpush cxcmp stustored,0je exilea si,stutemplea di,studentxmov ax,stustoredmov bl,17mul bladd di,axmov cx,17;rep movsbinc stustoredexi:pop cxpop bxpop axpop dipop siretinsert endp;------------------------------------------------------------------------ stor proc nearpush axpush bxpush dxpush dipush sipush cxcmp namelen,0je qstocldmov ax,stustoredmov bl,17mul bllea dx,studentxmov stu,dxadd stu,axmov di,stulea si,namefldmov cx,6rep movsblea si,numfldmov cx,8rep movsbmov cx,3lea si,scofldrep movsbinc stustoredqsto:pop cxpop sipop dipop dxpop bxpop axretstor endp;------------------------------------------------------------------------ modify proc nearpush bpmov bp,sppush bxpush dxpush dipush cxmov bx,[bp+4]cmp bx,1je mdnamcmp bx,2je mdnumlea dx,studentx+14jmp findmdnam:lea dx,studentxjmp findmdnum:lea dx,studentx+6find:push dxpush bxcall near ptr searchcmp ax,-1je qu_modmov di,ax;cmp bx,1je mnamcmp bx,2je mnumlea dx,msg_nscomov ah,9int 21hlea dx,scoparmov ah,0ahint 21hmov cx,3lea si,scofldjmp mfymnam:lea dx,msg_nnamemov ah,9int 21hcall inputnamemov cx,6lea si,namefldjmp mfymnum:lea dx,msg_nnummov ah,9int 21hlea dx,numparmov ah,0ahint 21hmov cx,8lea si,numfldmfy:rep movsbmov saveflag,0mov ax,1qu_mod:pop cxpop dipop dxpop bxpop bpret 2modify endp;------------------------------------------------------------------------ stat proc nearpush cxpush bxpush dxpush axmov cx,stustoredlea bx,[studentx+14]sta:mov dx,[bx]mov ah,[bx+2]cmp dl,'1'je a90cmp dh,'9'jae a90cmp dh,'8'jae a80cmp dh,'7'jae a70cmp dh,'6'jae a60add b60,1jmp repeata90:add ae90,1jmp repeata80:add ae80,1jmp repeata70:add ae70,1jmp repeata60:add ae60,1repeat:add bx,17loop stashowmsg stattitshowmsg _titlelnshowmsg _b60mov bl,byte ptr b60call deciasccrlfmshowmsg _titlelnshowmsg _ae60mov bl,byte ptr ae60call deciasccrlfmshowmsg _titlelnshowmsg _ae70mov bl,byte ptr ae70call deciasccrlfmshowmsg _titlelnshowmsg _ae80mov bl,byte ptr ae80call deciasccrlfmshowmsg _titlelnshowmsg _ae90mov bl,byte ptr ae90call deciasccrlfmshowmsg _titlelnmov ae90,0mov ae80,0mov ae70,0mov ae60,0mov b60,0pop axpop dxpop bxpop cxretstat endp;------------------------------------------------------------------- errm proc nearpush axmov ah,9int 21hmov errcde,01pop axreterrm endp;------------------------------------------------------------------- input proc nearpush axpush dxcall near ptr clearcall near ptr cursorcmp stustored,29ja i1mov ah,09lea dx,msg02;display promptint 21hiloop:cmp stustored,29ja i1call near ptr inputnamecmp namelen,0je i2call near ptr inputnumcall near ptr inputscocall near ptr storjmp iloopmov saveflag,0jmp i2i1:mov ah,9lea dx,msg20;'There are more than 30 students.' int 21hi2:showmsg back;'Press any key to back.'i3:mov saveflag,0pop dxpop axretinput endp;---------------------------------------------------------------------- inputname proc nearpush axpush dxpush bxpush cxshowmsg 03mov ah,0ahlea dx,nameparint 21hcrlfmmov bh,0mov bl,namelenmov cx,7sub cx,bxn10:mov namefld[bx],20hinc bxloop n10pop cxpop bxpop dxpop axretinputname endp;----------------------------------------------------------------------- inputnum proc nearpush axpush dxpush bxpush cxshowmsg 04mov ah,0ahlea dx,numparint 21hcrlfmmov bh,0mov bl,numlenmov cx,9sub cx,bxn20:mov numfld[bx]inc bxloop n20pop cxpop bxpop dxpop axretinputnum endp;---------------------------------------------------------------------- inputsco proc nearpush axpush dxpush bxpush cxshowmsg 05mov ah,0ahlea dx,scoparint 21hcrlfmmov bh,0mov bl,scolenmov cx,4sub cx,bxn21:mov scofld[bx],20hinc bxloop n21pop cxpop bxpop dxpop axretinputsco endp;------------------------------------------------------------------------ print proc nearpush sipush cxpush dxpush axcmp stustored,0je qprintcrlfmcrlfmshowmsg printtitleshowmsg seplnlea si,studentxmov cx,stustoredpline: call near ptr printlineloop plinepop axpop dxpop cxpop siqprint:retprint endp;------------------------------------------------------------------------ printline proc nearpush dipush cxpush dxpush axlea di,studisp;stutemp=studentx[i]mov cx,6rep movsbmov [studisp+6],9add di,1mov cx,8rep movsbmov [studisp+15],9add di,1mov cx,3rep movsbmov ah,9lea dx,studispint 21hcrlfmshowmsg seplnpop axpop dxpop cxpop diretprintline endp;------------------------------------------------------------------------ deciasc proc nearmov ch,100dmov cl,10dre:cmp ch,0je qdecimov al,bl;cbwdiv ch;mov bl,ahcall near ptr printitmov al,chcbwdiv clmov ch,aljmp reqdeci:retdeciasc endp;--------------------------------------------------------------------printit proc nearadd al,30hmov dl,almov ah,2int 21hretprintit endp;-------------------------------------------------------------------- stor2 proc nearpush sipush dipush axpush bxpush cxcmp stutemp,0je exittlea si,stutemplea di,studentxmov ax,stustoredmov bl,17mul bladd di,axmov cx,17;rep movsbinc stustoredpop cxpop bxpop axpop dipop siexitt: retstor2 endp;------------------------------------------------------------------------ get_path proc nearpush axpush bxpush dxshowmsg 22;'Please input the file you want to operate:' mov ah,0ahlea dx,pathparint 21h;crlfmmov bl,pathlenmov bh,0mov pathnam[bx],0pop dxpop bxpop axretget_path endp;--------------------------------------------------------------------openh proc nearpush axpush cxpush dxcall near ptr get_pathmov ah,3dhmov cx,0lea dx,pathnamint 21hjc o1mov filehandle,axpop dxpop cxpop axreto1:mov endcde,01lea dx,opnmsgcall near ptr errmpop dxpop cxpop axretopenh endp;-------------------------------------------------------------------- readall proc nearpush axmov endcde,0call near ptr openhcmp endcde,0jne rexit;endcde=1mov stustored,0contin:call near ptr readhcmp endcde,0jne r20;endcde=1call near ptr stor2cmp stustored,30ja oexitjmp continr20:call near ptr clsehcall clearcall cursorshowmsg 23jmp rexitoexit:call near ptr clsehmov saveflag,0showmsg 09;rexit:showmsg back;pop axretreadall endp;----------------------------------------------------------------------- readh proc nearpush axpush bxpush cxpush dxmov ah,3fh;read filemov bx,filehandlemov cx,17lea dx,stutempint 21hjc c1cmp ax,0je c2;ax=0,end of file,quitcmp stutemp,1ah;EOF Marker?je c2pop dxpop cxpop bxpop axretc1:lea dx,readmsgcall near ptr errmc2:mov endcde,1pop dxpop cxpop bxpop axretreadh endp;----------------------------------------------------------------------- save proc nearpush cxpush axmov errcde,0call near ptr clearcall near ptr cursorcall near ptr creathcmp errcde,0jne s2sloop:mov cx,stustoredcmp stusaved,cxje sexitcall near ptr writhcmp errcde,0jne sexitjmp sloopsexit:call near ptr clsehmov saveflag,1showmsg 07s2:showmsg exitanykeymov stusaved,0pop axpop cxretsave endp;------------------------------------------------------------------------ creath proc nearpush axpush cxpush dxshowmsg 21call near ptr get_pathcrlfmmov ah,3chmov cx,0lea dx,pathnamint 21hjc a1mov filehandle,axpop dxpop cxpop axreta1:lea dx,opnmsgcall errmpop dxpop cxpop axretcreath endp;------------------------------------------------------------------------ clseh proc nearpush axpush bxmov ah,3ehmov bx,filehandleint 21hpop bxpop axretclseh endp;------------------------------------------------------------------------ writh proc nearmov ax,stusavedmov bl,17mul bllea dx,studentxadd dx,ax;dxmov ah,40hmov bx,filehandlemov cx,17;cxint 21hinc stusavedjnc d1lea dx,wrtmsgcall near ptr errmd1:retwrith endp;------------------------------------------------------------------------ clear proc nearpush axpush bxpush cxpush dxmov AX,0600H ;clear screenmov CX,0mov DX,174FHmov BH,07int 10Hpop dxpop cxpop bxpop axretclear endp;------------------------------------------------------------------------ cursor proc nearpush axpush bxpush dxmov ah,2mov bh,0mov dx,0;dh:row,dl:columnint 10hpop dxpop bxpop axretcursor endpcode endsend start三.实验总结(心得、体会、实验设计不足之处)。

云南大学软件学院汇编语言实验报告五

云南大学软件学院汇编语言实验报告五

练习:多字节的二进制加法程序实验
1.实验内容
将两个4字节长的二进制数相加,运算结果存放在相应结果单元中。

2.说明
首先应安排程序的结构,其中代码段和数据段是必须有的。

代码段里实现数的相加,可用带进位的加法指令;数据段中存放被加数、加数和结果单元这些数据。

考虑到编程的方便,在定义加数和被加数时,将低位字节放到低地址,高位字节放在高地址。

进行加法运算时,按照由低地址到高地址的顺序取得数据,而每一步运算的结果也按照低位放在低地,高位放在高地址的方式进行存储。

源程序:
DATAS SEGMENT
DATA1 DD AB464431H
DATA2 DDAC5434H
DATA3 DW 2 DUP(0);
DATAS ENDS
STACKS SEGMENT
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
MOV BP,0
LEA SI,DATA1 ;
LEA DI,DATA2
MOV AX,[SI]
ADD AX,[DI] ;
JC L ;
MOV 4[DATA3],AX ;
MOV AX,0
LOOP1: MOV AX,4[SI] ;
ADD AX,4[DI]
JMP LOOP3
LOOP2: MOV AX,1 ;
JMP LOOP3
LOOP3: MOV [DATA3],AX ;
MOV AH,4CH
INT 21H
CODES ENDS
END START。

云南大学软件学院大学物理实验报告六

云南大学软件学院大学物理实验报告六

云南大学软件学院 实验报告课程: 大学物理实验 学期: 2012-2013学年 第一学期 任课教师: 张德海 专业: 数字媒体技术 学号: 20111120248 姓名: 赵云涛 成绩:实验6 示波器一、 实验目的1.学会使用信号发生器。

2.学会用示波器观察波形以及测量电压、周期和频率。

二、 实验内容1.观察信号发生器波形2.测量正弦波电压在示波器上调节出大小适中、稳定的正弦波形,选择其中一个完整的波形,先测算出正弦波电压峰—峰值U p-p ,即:U p-p =(垂直距离DIV )×(档位V/DIV )×(探头衰减率)= 20.0v然后求出正弦波电压有效值U 为2U 71.0U p p -⨯== 7.1v3.测量正弦波周期和频率在示波器上调节出大小适中、稳定的正弦波形,选择其中一个完整的波形,先测算出正弦波的周期T ,即T =(水平距离DIV )×(档位t/DIV )= 150.0s然后求出正弦波的频率T f 1= = 0.0067 Hz 。

4.观察李萨如图形(1)将示波器的显示模式切换为A/B ,A 通道接到如图电路的位置1,调节信号发生器输出电压的频率为50Hz ;信号发生器2的输出端接到示波器B 通道,分别调节输出正弦波的频率为50Hz 、75Hz 、100Hz 、150Hz ,观察并记录各种李萨如图形。

(2)将示波器的显示模式切换为A/B ,A 通道接到如图电路的位置2,调节信号发生器输出电压的频率为50Hz ;信号发生器2的输出端接到示波器B 通道,分别调节输出正弦波的频率为50Hz 、75Hz 、100Hz 、150Hz ,观察并记录各种李萨如图形。

思考题1. 信号的幅值对李萨如图形有影响么?答:会影响到,李萨如图的形状会随两个信号的幅值以及位相不同而变化。

2. 要获得稳定的李萨如图形,两个信号的频率应符合什么样的关系?答:李萨如图上的每一个点都可以用以下的公式进行表示:X=A1sin(ω1t+ψ1) ,Y=A2sin(ω2t+ψ2) 。

云南大学设计模式实验报告4_命令模式

云南大学设计模式实验报告4_命令模式

云南大学软件学院实验报告序号:姓名:学号:专业:软件工程日期:2015.12.21 成绩:实验四命令模式的运用一、实验目的:命令模式将“请求”封装成对象,以便使用不同的请求、队列或者日志来参数化其他对象,命令模式也支持可撤销的操作。

在熟悉命令模式相关理论知识的基础上,使用命令模式实现图片处理程序。

二、实验要求:使用命令模式实现图片处理程序,要求如下:1.图片处理程序要有3张图片。

2.每张图片至少有3种操作。

3.实现类似遥控器的菜单,动态的选择对图片进行的处理。

4.要有“撤消操作”,撤消操作要可以撤销至最后一步。

1、设计并绘制该程序的类图;2、依照设计的类图使用Java语言编写代码,并实现该程序;3、除了核心的模式相关类实现外,提供测试环境,按照难度高低,分别是:a)控制台程序,Client硬编码初始化模式和测试环境,运行结果文本输出;b)控制台程序,Client初始化测试环境,并根据用户输入运算,运行结果文本输出;c)设计并实现用户UI,Client初始化测试环境,并根据用户在UI控件上的输入运算,运行结果文本输出;三、实验内容:实验类图:实验代码:1 DrawControl类public class DrawControl {ArrayList<DrawCommand> dcommand=new ArrayList<DrawCommand>();public void addCommand(DrawCommand dc){dcommand.add(dc);}public void removeCommand(DrawCommand dc){for(int i=0;i<dcommand.size();i++)if(dcommand.get(i).getClass().equals(getClass())){dcommand.remove(i);}}public void executeCommand(DrawCommand dc){for(int i=0;i<dcommand.size();i++)if(dcommand.get(i).getClass().equals(getClass())){dcommand.get(i).execute();}}public void undoCommand(DrawCommand dc){if (dcommand.size() > 1) {dcommand.get(dcommand.size() - 1).undo();dcommand.remove(dcommand.size() - 1);} elseSystem.out.println("Here is end, you can't undo");}}2 DrawCommand接口类package design4;interface DrawCommand {public void execute();public void undo();}3 Circular类public class Circular extends JPanel {Ellipse2D e =null;private int w,h;int f;public Circular(int w,int h){this.w=w;this.h=h;} //画圆型public void drawCircular(){e=new Ellipse2D.Double(w/2,h/4,50,50);f=1;repaint();} //画椭圆形public void drawEllipse(){e=new Ellipse2D.Double(w/2,h/4,20,70);f=1;repaint();} //画实心圆public void drawSolidRound(){f=2;e=new Ellipse2D.Double(w/2,h/4,50,50);repaint();}public void paintComponent(Graphics g){super.paintComponent(g);if(f==1){Graphics2D g2=(Graphics2D) g;g2.draw(e);}else{Graphics2D g2=(Graphics2D) g;//g2.draw(e);g2.setPaint(Color.RED);g2.fill(e);}}}4 Circular Command类package design4;public class CircularCommand implements DrawCommand{ Circular circular;public CircularCommand(Circular c){circular=c;}public void execute() {circular.drawCircular();}public void undo() {// TODO Auto-generated method stub}}5 DrawJFrampackage design4;import java.awt.Container;import java.awt.GridLayout;import java.awt.Panel;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JComboBox;import javax.swing.JFrame;import javax.swing.JLabel;public class DrawJFram extends JFrame implements ActionListener{JComboBox comboBox,comboBox2,comboBox3;String[] str={"圆形","椭圆","实心圆"};String[] str2={"方形","正方形","长方形"};String[] str3={"三角形","等腰直角三角形","等边三角形"};public DrawJFram (){super(" ");this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setcomputerWindow();}private void setcomputerWindow() {// TODO Auto-generated method stub Container ct=this.getContentPane();Container ct=this.getContentPane();ct.setLayout(new GridLayout(6,1));Panel p1=new Panel();p1.add(new JLabel("圆形:"));comboBox=new JComboBox(str);p1.add(comboBox);p1.add(new JLabel("方形:"));comboBox2=new JComboBox(str2);p1.add(comboBox2);p1.add(new JLabel("三角形:"));comboBox3=new JComboBox(str3);p1.add(comboBox3);comboBox.addActionListener(this);comboBox2.addActionListener(this);comboBox3.addActionListener(this);ct.add(p1,"North");}public void actionPerformed(ActionEvent e) {if(e.getSource().equals(comboBox)){if(comboBox.getSelectedItem().equals("圆形")){Circular circular=new Circular(100, 100);this.add(circular,"South");circular.drawCircular();this.setVisible(true);}else if(comboBox.getSelectedItem().equals("椭圆")){Circular circular=new Circular(30, 70);this.add(circular,"South");circular.drawEllipse();this.setVisible(true);}else if(comboBox.getSelectedItem().equals("实心圆")){Circular circular=new Circular(50, 50);this.add(circular,"South");circular.drawSolidRound();this.setVisible(true);}}else if(e.getSource().equals(comboBox2)){if(comboBox2.getSelectedItem().equals("方形")){Rectangle rectangle=new Rectangle(100, 100);this.add(rectangle,"South");rectangle.drawhighRectangle();this.setVisible(true);}else if(comboBox2.getSelectedItem().equals("长方形")){ Rectangle rectangle=new Rectangle(100, 100);this.add(rectangle,"South");rectangle.drawlongRectangle();this.setVisible(true);}else if(comboBox2.getSelectedItem().equals("正方形")){ Rectangle rectangle=new Rectangle(100, 100);this.add(rectangle,"South");rectangle.drawsquare();this.setVisible(true);}}else if(e.getSource().equals(comboBox3)){if(comboBox3.getSelectedItem().equals("三角形")){Triangle triangle=new Triangle(500, 10);this.add(triangle,"South");triangle.drawTriangle();this.setVisible(true);}else if(comboBox3.getSelectedItem().equals("等腰直角三角形")){ Triangle triangle=new Triangle(500, 30);this.add(triangle,"South");triangle.drawIsoscelesTriangle();this.setVisible(true);}else if(comboBox3.getSelectedItem().equals("等边三角形")){ Triangle triangle=new Triangle(500, 50);this.add(triangle);triangle.draweQuilateralTriangle();this.setVisible(true);}}}}6 pictureMainpackage design4;import java.awt.Dimension;import java.awt.Toolkit;public class pictureMain {public static void main(String[] args) {// TODO Auto-generated method stubToolkit kit=Toolkit.getDefaultToolkit();Dimension screenSize=kit.getScreenSize();int screenHeihgt=screenSize.height;int screenWidth=screenSize.width;DrawJFram drawJFram=new DrawJFram();drawJFram.setSize(screenWidth,screenHeihgt);drawJFram.setVisible(true);}}实验结果四、实验总结:我经过本次命令模式的实验,通过自己动手编代码,是自己理解命令模式机制,并且知道命令模式有以下的优点:适用性:想要实现回调函数功能,想要在不同的时刻指定、排列和执行请求,需要支持取消和改变日志操作;效果:命令模式将调用操作的对象与知道如何实现该操作的对象解耦,Command是头等的对象。

云南大学软件学院数据库实验7:DB2_Customization

云南大学软件学院数据库实验7:DB2_Customization

云南大学软件学院实验报告课程:数据库原理与实用技术实验学期:2011-2012学年第二学期任课教师:专业:学号:姓名:成绩:Exercise 1_DB2 Customization Section 2 - Creating a New User ID1. Use the User Manager application to create your new user ID called inst1. Answer:1) create your new user ID called inst1.(用户名:inst1全名:inst1 Instance SysAdmin描述:System Administrator for INST1 Instance密码:inst1用户组:Administrators)右击计算机,选择管理,.2)更改inst1的账户类型在控制面板里,. Section 4 - Creating the Instance1. Open up a DB2 Command Window and issue the following command: db2ilist Record the output:Answer:在开始菜单里找到IBM的DB2,打开命令行工具输入db2ilist,查看主机的实例得:2. For your lab environment, you will create another instance called INST1. (创建称为inst1 的新实例)Answer:在命令窗口中输入如下命令:1)输入db2icrt inst1,创建称为inst1 的新实例2)查看你所创建的新实例inst1输入db2ilist后显示:3. Reissue the command to list your instances. Now which instances are listed?Answer:实例有:inst1 和DB2,Section 5 - Creating the DB2 System Administrator Group(建立DB2 系统管理员用户组)按以下要求建立DB2 系统管理员用户组adm1(adm1 应小写而且),并且使inst1 和db2admin成为该组成员组名:adm1描述:inst1 Instance SysAdmin Group可以桌面上,右击“计算机”,选择“管理”,右如下界面创建新组adm1(adm1 应小写而且),并且使inst1 和db2admin成为该组成员,同样,先建adm1再按照要求添加那2个用户,就可以了结果:Section 6 - Setting the Environment1. Perform the following tasks to check your DB2 environment variables.What is the DB2INSTANCE (default instance) Value in System Variables?Answer:做如下的选择Change the system variable value of DB2INSTANCE to INST1.所以,没有包含X:\SQLLIB\BIN2. Do the following to verify your DB2 environment variables are correct. Answer:选择开始菜单—>程序—>附件—>命令提示符;输入: set | more3. Check the values of your registry variables(注册变量表) (hint: use db2set on aDB2 Command Window).在DB2的命令窗口中What is the value for your DB2 Administration Server?Answer:4. What is your system name?Answer:Section 7 - Exploring and Setting Database Manager Configuration Parameters4. Record the following values:(打开控制中心,按照要求去找)a. Does the AUTHENTICATION parameter have a value (look under theAdministration)? What is the purpose of this parameter? What are the possible values for this parameter?answer:b. Does the SYSADM_GROUP parameter have a value (look underAdministration)? What is the value of this parameter? What is the hint associated with it?answer:c. What is the value of NODETYPE (look under Environment) answer:。

实验六实验报告

实验六实验报告

实验六实验报告云南大学软件学院实验报告课程:数据库原理与实用技术实验任课教师:包崇明姓名:匿名学号:2013…….专业:软件工程成绩:实验6 数据库完整性实验6-1 完整性约束1、在学生表上面创建下列CHECK约束【注】:因为学生表已经存在,所以这里使用添加check约束的方法实现:(1)创建入学日期约束“Enter_University_date_rule”,假定该学校于1923年4月30日创建。

要求:入学日期必须大于等于学校创建日期,并且小于等于当前日期测试语句:结果(添加的check约束起作用了),如图:(2)创建学生年龄约束“Age_rule”。

要求:学生年龄必须在15~30岁之间测试语句结果(添加”Age_rule”成功,并且年龄为’2015/4/27’没有违反”Enter_University_date_rule”约束,进一步说明了(1)中的check约束添加成功,如图:【注】:考虑到时间关系,下面的部分解答中将会省略测试约束的步骤。

(3)创建学生性别约束“Sex_rule”。

要求:性别只能为“男”或“女”(4)创建学生成绩约束“Score_rule”。

要求:学生成绩只能在0~100之间(5)用图形方法查看学生成绩约束“Score_rule”,截图为:2、删除约束Enter_University_date_rule测试语句:结果:(更新成功)3、创建声明式默认约束:在创建表的过程中创建默认约束(1)创建表“default_example”,表中包含字段pid、name、sex、age。

要求设定sex的默认值为“男”、age的默认值为18。

创建default_example表语句:采用SQL语句进行插入元祖:执行结果为:(默认值起作用了!!)(2)插入一条编号为100 的记录,执行结果为:(3)修改默认值一般先删除老的默认约束,再新建一个默认约束方法如下:删除约束:alter TABLE default_example drop 约束名新建默认约束:alter TABLE default_example add constraint df_age default(20) for age①删除老的默认约束:②新建默认约束:请将年龄默认值更改为19,执行结果为:测试语句:结果(默认年龄被修改为19),如图:3、在“学生管理数据库”各个数据表中建立相应的主键、外键、惟一值、以及check约束,要求:学生的年龄必须是两位数,其中第一位是1或2:(1)学生表【添加主键和年龄约束】:(2)授课表【添加主键和外键】:(3)课程表【添加主键】:(4)成绩表【添加主键和外键】:第一次添加外键失败,因为两个表中的学号长度不等,所以我需要修改使其相等再添加。

云南大学--软件学院--大学物理实验2

云南大学--软件学院--大学物理实验2
云南大学软件学院实验报告
课程:大学物理实验学期:2009-2010学年第一学期任课教师:
班级:学号:序号: 姓名:成绩:
实验2质点运动学
一、实验内容1
1.证明公式: ,有关各个变量的定义见实验内容。
2.设定并记录发现目标距离、目标飞行高度、目标飞行速度;
发现目标距离
目标飞行高度
目标飞行速度
10000
11.45
11.44
11.43
11.42
11.423
水平误差
(米)Biblioteka 154.6137.4120.2
114.2
68.7
25.3
16.2
7.1
-2.0
1.0
观察角2= 16.820(度)
实验
1
2
3
4
5
6
7
8
9
10
发射角
(度)
33.5
33.3
32.9
32.7
32.3
32
31.9
31.5
31.4
31
水平误差
(米)
1000
500
3.根据程序显示的不同观察角,选定10个不同的拦截发射角,记录各个拦截发射角对应的拦截弹头与目标的水平误差;并分析拦截发射角等于多少,水平误差最小?记录2个不同观测角的情况。
观察角1= 5.834度)
实验
1
2
3
4
5
6
7
8
9
10
发射角
(度)
11.6
11.58
11.56
11.555
11.5
177.0
156.1
112.3
88.6

云南大学软件学院大学物理实验报告四

云南大学软件学院大学物理实验报告四

云南大学软件学院实验报告
课程:大学物理实验学期:2012-2013学年第一学期任课教师:张德海
专业:数字媒体技术学号:20111120242 姓名:赵云涛成绩:
实验4 静电场
一、实验目的
通过研究同心球壳电场及电势分布熟悉电场和电势的特性
二、实验原理
任何带电物体周围都会产生电场。

点电荷系中任一点处的场强等于各个点电荷单独存在时在该点各自产生的场强的矢量和,这就是电场场强的叠加原理。

三、实验任务
1.选取相关参数,截图如下:
2、得到电场分布图和电势分布图:。

云南大学软件学院汇编语言实验报告三

云南大学软件学院汇编语言实验报告三

五、练习
1. 已知程序段定义如下:
MOV AX,1234
MOV CL,4
SHL AX,CL
INC AX
DEC CL
ROR AX,CL
MOV BX,4
MUL BX
MOV BX,4
DIV BX
INT 20
(1)每条指令执行后,AX寄存器中的内容是什么?
(2)每条指令执行后,标志寄存器的各位标志等于什么?
(3)程序结束时,AX和DX的内容等于什么?
2. 编写一程序求双字数据的绝对值。

双字数据保存在DX和AX中,结果保存在BX和CX中。

3. 编制程序,将DX和AX中的双字右移4位。

mov ch,4
go: shr dx,1
rcr ax,1
dec ch
jnz go
4. 编制程序,判断DL寄存器的低4位是否全为0?是否有0?判断AL寄存器中的数值是奇数还是偶数?是否为4的倍数?
6. 编制程序,用一条指令让AX寄存器清0;用一条指令使DX寄存器高3位为1,其余位保持不变;用一条指令使BL寄存器低4位为0,其余位保持不变;用一条指令,使SI和DI寄存器中对应位不相同的位置均置1;
7. 从内存3000H开始的单元中顺序存放着40个同学某门课的考试成绩,试编写程序段求该班该门课的总成绩和平均成绩。

云南大学软件学院汇编语言实验报告二

云南大学软件学院汇编语言实验报告二

五、练习
1. 传送指令
1)用A命令在内存100H处键入下列内容:
MOV AX,1234
MOV BX,5678
XCHG AX,BX
MOV AH,35
MOV AL,48
MOV DX,75AB
XCHG AX,DX
2)用U命令检查键入的程序并记录,特别注意左边的机器码。

3)用T命令逐条运行这些指令,每运行一行检查并记录有关寄存器及IP的变化情况。

并注意标志位有无变化。

2. 改变标志寄存器psw中AF标志的状态(0——1或1——0),其余位保持不变。

3. 设DS=当前段地址,BX=0300H,SI=0002H,请用DEBUG的命令将存储器偏移地址
300H~304H连续单元顺序装入0AH,0BH,0CH,0DH,0EH。

在DEBUG状态下使用A命令送入下面程序,并用单步T命令执行的方法,分析每条指令源地址的形成过程?当数据传送每完成一次,试分析AX寄存器中的内容是什么?
程序清单如下:
MOV AX,BX
MOV AX,0304H
MOV AX,[0304H]
MOV AX,[BX]
MOV AX,0001[BX]
MOV AX,[BX][SI]
HLT
4. 使用标志位传送指令,编程序段将标志位寄存器的低八位的值存入内存单元DS:1000H中或堆栈中,然后将标志位寄存器的低八位置位为10101010。

云南大学软件学院PKI体系与CA技术实验2

云南大学软件学院PKI体系与CA技术实验2

云南大学软件学院实验报告课程:PKI体系与CA技术学期:2015-2016学年第二学期任课教师:刘璟专业:信息安全学号219 姓名:刘宁宁成绩:实验2 使用OpenSSL创建自己的签证中心实验时间:实验地点:软件大楼1428 ;注意:实验报告统一命名为:学号姓名实验1.docx,例如:学号为203的张三同学提交的实验报告应该命名为:203张三实验1.docx一、实验目的1. 学会开源软件OpenSSL的编译和安装,从而掌握一般开源软件的编译和安装方法(指Unix系统下的开源软件的编译和安装方法)。

2. 使用OpenSSL创建自己的签证(CA)中心。

3. 学会使用OpenSSL来管理数字证书的整个生命周期。

4. 熟悉OpenSSL,为以后在OpenSSL基础上做进一步的编程开发工作打下基础。

二、实验内容1. 在Windows环境下编译和安装开源软件OpenSSL,掌握围绕makefile文件的软件编译和安装方法。

2. 应用OpenSSL来创建自己的签证(CA)中心:1)为签证中心创建工作环境;2)研究OpenSSL配置文件,并创建一个自己的OpenSSL配置文件;3)生成CA自签名的根证书,并了解CA自签名根证书的作用。

4)为用户签发(颁发)数字证书;5)吊销已签发的数字证书。

三、详细实验步骤(关键步骤请截屏)1.openssl的安装:Perl安装完成:为Visual Studio 2010(Visual C++)设置临时环境变量:执行如下Configure命令(该步骤的目的是配置编译参数,对编译环境进行基本的配置):perl Configure VC-WIN32至此,openssl的配置完成。

2.使用openssl创建自己的签证中心建立CA目录:创建OpenSSL配置文件:修改req项里面的内容:运行命令:C:\CARoot>openssl req -x509 -newkey rsa -out private\cacert.pem -outform PEM在命令行输入C:\CARoot> openssl ca -in testreq.pem生成了一个名为“01.pem”的数字证书4、吊销已经签发的数字证书:如下命令:C:\CARoot>openssl ca -revoke newcerts\01.pem生成一个证书吊销列表exampleca.crl:C:\CARoot>openssl ca -gencrl -out exampleca.crl输入命令:C:\CARoot>openssl crl -in exampleca.crl -text -noout成功吊销证书,显示verify OK:四、实验总结通过回答以下几个问题来进行总结:1.实验一种我们从沃通官网下载的数字证书格式为PFX,在本实验中我们使用OpenSSL生成的数字证书格式为PEM,试比较两种证书格式的异同?答:该编码格式在RFC1421中定义,其实PEM是Privacy-Enhanced Mail的简写,但他也同样广泛运用于密钥管理,一般基于base 64编码。

云南大学软件学院计算机网络原理实验六实验报告3

云南大学软件学院计算机网络原理实验六实验报告3

实验六、传输层可靠传输协议GBN编程实验报告序号:姓名:学号:成绩指导老师:一、实验目的:1、通过编写实现一个简单可靠的数据传输协议GBN的发送和接收代码,模拟可靠数据传输2、理解TCP协议可靠传输的差错检测、重传、累计确认、定时器的可靠传输策略。

二、实验指导:参考教材。

动画演示:三、实验要求:编程实现一个GBN传输协议的发送方和接收方两程序,采用编程语言不限,要求能将发送――接收流程以及处理方法表现出来.1.实验流程图如下:N2.实验截图与代码如下: 截图: 传送下一个数据包结束代码及注释:一、GBN.h#pragma once#include <stdio.h>//基础功能模块的数据结构声明#define BIDIRECTIONAL 1 /* change to 1 if you're doing extra credit andwrite a routine called B_output *//* a "msg" is the data unit passed from layer 5 (teachers code) to layer4 (students' code). It contains the data (characters) to be delivered tolayer 5 via the students transport level protocol entities. */struct msg{ char data[20];};/* a packet is the data unit passed from layer 4 (students code) to layer3 (teachers code). Note the pre-defined packet structure, which allstudents must follow. */struct pkt{int seqnum;int acknum;int checksum;char payload[20];};#define WINDOWSIZE 8#define MAXBUFSIZE 50#define RTT 15.0#define NOTUSED 0#define NACK -1#define TRUE 1#define FALSE 0#define A 0#define B 1//网络仿真部分数据结构声明***********************************************************struct event{float evtime; /* event time */int evtype; /* event type code */int eventity; /* entity where event occurs */struct pkt *pktptr; /* ptr to packet (if any) assoc w/ this event */ struct event *prev;struct event *next;};/* possible events: */#define TIMER_INTERRUPT 0#define FROM_LAYER5 1#define FROM_LAYER3 2#define OFF 0#define ON 1//基础功能模块的函数声明******************************************************************* void ComputeChecksum(struct pkt *packet);//计算校验和int CheckCorrupted(struct pkt packet);//检查数据是否出错void A_output( struct msg message);//A端向外发送数据void A_input(struct pkt packet);//A端接收数据void A_timerinterrupt();//A计时器超时void A_init();//A端初始化void B_output(struct msg message);void B_input(struct pkt packet);void B_timerinterrupt();void B_init();//网络仿真部分的函数声明**************************************************void init(); //初始化仿真器float jimsrand();//随机数发生器[0,1]//处理事件列表部分的函数声明*********************************************void generate_next_arrival();//产生下一个到达的分组void insertevent(struct event *p);//向事件列表中插入一条新的事件void printevlist();//打印事件列表//******************************************************************** //**********************计时器模块*********************************** void stoptimer(int);//停止计时器void starttimer(int,float);//启动计时器//******************************************************************** *//**************************网络各层之间传送模块***********************void tolayer3(int AorB,struct pkt packet);//向第3层发送信息void tolayer5(int AorB,char datasent[20]);//向第5层发送信息二、GBN.c#include "GBN.h"#include <stdio.h>#include <string.h>#include <stdlib.h>extern int TRACE = 1; /* for my debugging */为我的调试extern int nsim = 0; /* number of messages from 5 to 4 so far */目前为止信息的数字是从5到4extern int nsimmax = 0; /* number of msgs to generate, then stop */如果信息产生的数字为0,然后就停止extern float time = 0.000;float lossprob; /* probability that a packet is dropped */数据包可能会丢失float corruptprob; /* probability that one bit is packet is flipped*/这一点的数据包可能会被弹出去float lambda; /* arrival rate of messages from layer 5 */ 第五层到达的信息的次序int ntolayer3; /* number sent into layer 3 */被传送到第三层的数据static int nlost = 0; /* number lost in media */在媒介中数据丢失static int ncorrupt = 0; /* number co rrupted by media*/被媒介毁坏的数据static int expectedseqnum = 0; /* expected se quence number at receiver side */在接收者这边接收到预期的序列数据static int nextseqnum; /* next sequence number to use in sender side */下一个序列数据使用在发送者这边static int base; /* t he head of sender window */发送者的头窗口struct pkt winbuf[WINDOWSIZE]; /* window packets buffer */数据包缓冲区窗口static int winfront,winrear; /* front and rear points of wind ow buffer */窗口缓冲区的前方点和后方点static int pktnum; /* packet number of window buffer */窗口缓冲区的数据包个数struct msg buffer[MAXBUFSIZE]; /* sender message buffer */发送消息缓冲区int buffront,bufrear; /* front and rear pointers of buffer */缓冲区的前指针与后指针static int msgnum; /* message number of buffer */信息数量的缓冲int packet_lost =0;int packet_corrupt=0;int packet_sent =0;extern int packet_correct=0;extern int packet_resent =0;int packet_timeout=0;extern struct event *evlist = NULL; /* the event list *///计算校验和void ComputeChecksum( struct pkt *packet){int checksum;int i;checksum = packet->seqnum;checksum = checksum + packet->acknum;for ( i=0; i<20; i++ )checksum = checksum + (int)(packet->payload[i]);checksum = 0-checksum;packet->checksum = checksum;}//检查是否出错int CheckCorrupted(struct pkt packet){int checksum;int i;checksum = packet.seqnum;checksum = checksum + packet.acknum;for ( i=0; i<20; i++ )checksum = checksum + (int)(packet.payload[i]);if ( (packet.checksum+checksum) == 0 )return (FALSE);elsereturn (TRUE);}//A端向外发送数据/* called from layer 5, passed the data to be sent to other side */ void A_output(struct msg message){int i;struct pkt sendpkt;/* if window is not full */if ( nextseqnum < base+WINDOWSIZE ){printf("----A: New message arrives, send window is not full, send new messge to layer3!\n");/* create packet */sendpkt.seqnum = nextseqnum;sendpkt.acknum = NOTUSED;for ( i=0; i<20 ; i++ )sendpkt.payload[i] = message.data[i];/* computer checksum */ComputeChecksum (&sendpkt);/* send out packet */tolayer3 (A, sendpkt);/* copy the packet to window packet buffer */winrear = (winrear+1)%WINDOWSIZE;pktnum ++;winbuf[winrear] = sendpkt;for (i=0; i<20; i++)winbuf[winrear].payload[i]= sendpkt.payload[i];/* update state variables */nextseqnum = nextseqnum+1;starttimer(A,RTT);B_input(sendpkt);A_input(sendpkt);}/* if window is full */else{printf("----A: New message arrives, send window is full,");/* if buffer full, give up and exit*/if ( msgnum == MAXBUFSIZE){printf (" Error: Sender buffer is full! \n");exit (1);}/* otherwise, buffer the message */else{printf("buffer new message!\n");bufrear = (bufrear+1) % MAXBUFSIZE;for (i=0; i<20; i++)buffer[bufrear].data[i] = message.data[i];msgnum ++;}}}//B端向外发送数据/* called from layer 5, passed the data to be sent to other side */ void B_output(struct msg message){int i;struct pkt sendpkt;/* if window is not full */if ( nextseqnum < base+WINDOWSIZE ){printf("----A: New message arrives, send window is not full, send new messge to layer3!\n");/* create packet */sendpkt.seqnum = nextseqnum;sendpkt.acknum = NOTUSED;for ( i=0; i<20 ; i++ )sendpkt.payload[i] = message.data[i];/* computer checksum */ComputeChecksum (&sendpkt);/* send out packet */tolayer3 (A, sendpkt);A_input(sendpkt);/* copy the packet to window packet buffer */winrear = (winrear+1)%WINDOWSIZE;pktnum ++;winbuf[winrear] = sendpkt;for (i=0; i<20; i++)winbuf[winrear].payload[i]= sendpkt.payload[i];/* if it is the first packet in window, start timeout */ //if ( base == nextseqnum )//{//starttimer(A,RTT);//printf("----A: start a new timer!\n");// }/* update state variables */nextseqnum = nextseqnum+1;}/* if window is full */else{printf("----A: New message arrives, send window is full,");/* if buffer full, give up and exit*/if ( msgnum == MAXBUFSIZE){printf (" Error: Sender buffer is full! \n");exit (1);}/* otherwise, buffer the message */else{printf("buffer new message!\n");bufrear = (bufrear+1) % MAXBUFSIZE;for (i=0; i<20; i++)buffer[bufrear].data[i] = message.data[i];msgnum ++;}}}//A端接收数据void A_input(struct pkt packet){struct pkt sendpkt;int i;/* if received packet is not corrupted and ACK is received */if ( (CheckCorrupted(packet) == FALSE) && (packet.acknum != NACK) ) {printf("----A: ACK %d is correctly received,",packet.acknum);packet_correct++;/* delete the acked packets from window buffer */winfront = (winfront+(packet.acknum+1-base)) % WINDOWSIZE; pktnum = pktnum - (packet.acknum+1-base);/* move window base */base = packet.acknum+1;stoptimer(A);if ( base < nextseqnum){//starttimer(A,RTT);printf ("\n\n\nsend new packets!");}/* if buffer is not empty, send new packets */while ( (msgnum!=0) && (nextseqnum<base+WINDOWSIZE) ) {/* create packet */sendpkt.seqnum = nextseqnum;sendpkt.acknum = NOTUSED;buffront = (buffront+1) % MAXBUFSIZE;for ( i=0; i<20 ; i++ )sendpkt.payload[i] = buffer[buffront].data[i];/* computer checksum */ComputeChecksum (&sendpkt);/* if it is the first packet in window, start timeout */if ( base == nextseqnum ){//starttimer(A,RTT);printf ("send new packets!\n");}/* send out packet */tolayer3 (A, sendpkt);/* copy the packet to window packet buffer */winrear = (winrear+1)%WINDOWSIZE;winbuf[winrear] = sendpkt;pktnum ++;/* update state variables */nextseqnum = nextseqnum+1;/* delete message from buffer */msgnum --;}}elseprintf ("----A: NACK is received, do nothing!\n");}//B端接收数据*****************************************************一定要调用这个/* Note that with simplex transfer from a-to-B, there is no B_output() */ /* called from layer 3, when a packet arrives for layer 4 at B*/void B_input(struct pkt packet){struct pkt sendpkt;int i;/* if not corrupted and received packet is in order */if ( (CheckCorrupted(packet) == FALSE) && (packet.seqnum == expectedseqnum)){printf("\n----B: packet %d is correctly received, send ACK!\n",packet.seqnum);/* send an ACK for the received packet *//* create packet */sendpkt.seqnum = NOTUSED;sendpkt.acknum = expectedseqnum;for ( i=0; i<20 ; i++ )sendpkt.payload[i] = '0';/* computer checksum */ComputeChecksum (&sendpkt);/* send out packet *///tolayer3 (B, sendpkt);/* update state variables */expectedseqnum = expectedseqnum+1;printf("----B:expectedseqnum = %d\n",expectedseqnum);/* deliver received packet to layer 5 *///tolayer5(B,packet.payload);}/* otherwise, discard the packet and send a NACK */else{printf("----B: packet %d is corrupted or not I expects, send NACK!\n",packet.seqnum);/* create packet */sendpkt.seqnum = NOTUSED;sendpkt.acknum = NACK;for ( i=0; i<20 ; i++ )sendpkt.payload[i] = '0';/* computer checksum */ComputeChecksum (&sendpkt);/* send out packet */tolayer3 (B, sendpkt);}}//A计时器超时/* called when A's timer goes off */void A_timerinterrupt(){int i;printf("----A: time out,resend packets!\n");/* start timer */starttimer(A,RTT);/* resend all packets not acked */for ( i=1; i<=pktnum; i++ ){packet_resent++;tolayer3(A,winbuf[(winfront+i)%WINDOWSIZE]);}}//B计时器超时/* called when B's timer goes off */void B_timerinterrupt(){int i;printf("----B: time out,resend packets!\n");/* start timer */starttimer(B,RTT);/* resend all packets not acked */for ( i=1; i<=pktnum; i++ ){packet_resent++;tolayer3(B,winbuf[(winfront+i)%WINDOWSIZE]);}}//A端初始化/* entity A routines are called. You can use it to do any initialization */void A_init()base = 0;nextseqnum = 0;buffront = 0;bufrear = 0;msgnum = 0;winfront = 0;winrear = 0;pktnum = 0;}//B端初始化/* entity B routines are called. You can use it to do any initialization */void B_init(){expectedseqnum = 0;}//初始化仿真器void init() /* initialize the simulator */{int i;float sum, avg;float jimsrand();FILE *fp;fp = fopen ("parameter.txt","r");printf("----- Stop and Wait Network Simulator Version 1.1 -------- \n\n");printf("Enter the number of messages to simulate: ");//fscanf(fp,"%d",&nsimmax);scanf("%d",&nsimmax);printf("\nEnter packet loss probability [enter 0.0 for no loss]: "); //fscanf(fp, "%f",&lossprob);scanf("%f",&lossprob);printf("\nEnter packet corruption probability [0.0 for no corruption]: "); //fscanf(fp,"%f",&corruptprob);scanf("%f",&corruptprob);printf("\nEnter average time between messages from sender's layer5 [ > 0.0]: ");//fscanf(fp,"%f",&lambda);scanf("%f",&lambda);printf("\nEnter TRACE: ");//fscanf(fp,"%d",&TRACE);scanf("%d",&TRACE);printf("\n\n");srand(9999); /* init random number generator */sum = 0.0; /* test random number generator for students */for (i=0; i<1000; i++)sum=sum+jimsrand(); /* jimsrand() should be uniform in [0,1] */avg = sum/1000.0;/*if(avg < 0.25 || avg > 0.75){printf("It is likely that random number generation on your machine\n" ); printf("is different from what this emulator expects. Please take\n"); printf("a look at the routine jimsrand() in the emulator code. Sorry. \n");exit(0);}*/printf("%f",avg);ntolayer3 = 0;nlost = 0;ncorrupt = 0;time=0.0; /* initialize time to 0.0 */generate_next_arrival(); /* initialize event list */}//随机数发生器float jimsrand(){double mmm = 2147483647; /* largest int - MACHINE DEPENDENT */float x; /* individual students may need to change mmm */x = rand()/mmm; /* x should be uniform in [0,1] */return(x);}//**************************************************************************************//*******************************事件处理部分*******************************************void generate_next_arrival(){double x,log(),ceil();struct event *evptr;float ttime;int tempint;//if (TRACE>2)//printf("-----------------GENERATE NEXT ARRIVAL: creating new arrival\n");x = lambda*jimsrand()*2; /* x is uniform on [0,2*lambda] *//* having mean of lambda */evptr = (struct event *)malloc(sizeof(struct event));evptr->evtime = time + x;evptr->evtype = FROM_LAYER5;if (jimsrand()<0.5){evptr->eventity = A;}evptr->eventity = B;insertevent(evptr);}//向事件列表中插入一条新的事件void insertevent(struct event *p){struct event *q,*qold;if (TRACE>2){//printf(" INSERTEVENT: time is %lf\n",time);//printf(" INSERTEVENT: future time will be %lf\n",p->evtime);}q = evlist; /* q points to front of list in which p struct inserted */if (q==NULL)/* list is empty */{evlist=p;p->next=NULL;p->prev=NULL;}else{for (qold = q; q !=NULL && p->evtime > q->evtime; q=q->next) qold=q;if (q==NULL)/* end of list */{qold->next = p;p->prev = qold;p->next = NULL;}else if (q==evlist)/* front of list */p->next=evlist;p->prev=NULL;p->next->prev=p;evlist = p;}else /* middle of list */{p->next=q;p->prev=q->prev;q->prev->next=p;q->prev=p;}}}//打印事件列表void printevlist(){struct event *q;int i;printf("--------------\nEvent List Follows:\n");for(q = evlist; q!=NULL; q=q->next){printf("Event time: %f, type: %d entity: %d\n",q->evtime,q->evtype,q->eventity);}printf("--------------\n");}//启动计时器void starttimer(int AorB,float increment){struct event *q;struct event *evptr;if (TRACE>2)printf("\n----A: START TIMER: starting timer at %f\n",time);/* be nice: check to see if timer is already started, if so, then warn *//* for (q=evlist; q!=NULL && q->next!=NULL; q = q->next) */for (q=evlist; q!=NULL ; q = q->next)if ( (q->evtype==TIMER_INTERRUPT && q->eventity==AorB) ){//printf("Warning: attempt to start a timer that is already started\n");return;}/* create future event for when timer goes off */evptr = (struct event *)malloc(sizeof(struct event));evptr->evtime = time + increment;evptr->evtype = TIMER_INTERRUPT;evptr->eventity = AorB;insertevent(evptr);}//停止计时器/* called by students routine to cancel a previously-started timer */ void stoptimer(int AorB) /* A or B is trying to stop timer */{struct event *q,*qold;if (TRACE>2)printf("\n----A: STOP TIMER: stopping timer\n");/* for (q=evlist; q!=NULL && q->next!=NULL; q = q->next) */for (q=evlist; q!=NULL ; q = q->next)if ( (q->evtype==TIMER_INTERRUPT && q->eventity==AorB) )/* remove this event */{if (q->next==NULL && q->prev==NULL)evlist=NULL; /* remove first and only event on listelse if (q->next==NULL) /* end of list - there is one in front */ q->prev->next = NULL;else if (q==evlist) /* front of list - there must be event after */{q->next->prev=NULL;evlist = q->next;}else /* middle of list */{q->next->prev = q->prev;q->prev->next = q->next;}free(q);return;}//printf("Warning: unable to cancel your timer. It wasn't running.\n");}//向第三层发送信息/************************** TOLAYER3 ***************/void tolayer3(int AorB,struct pkt packet){struct pkt *mypktptr;struct event *evptr,*q;float lastime, x, jimsrand();int i;ntolayer3++;/* simulate losses: */if (jimsrand() < lossprob){nlost++;if (TRACE>0)printf(" TOLAYER3: packet being lost\n");return;}/* make a copy of the packet student just gave me since he/she may decide *//* to do something with the packet after we return back to him/her */ mypktptr = (struct pkt *)malloc(sizeof(struct pkt));mypktptr->seqnum = packet.seqnum;mypktptr->acknum = packet.acknum;mypktptr->checksum = packet.checksum;for (i=0; i<20; i++)mypktptr->payload[i] = packet.payload[i];if (TRACE>2){printf(" TOLAYER3: seq: %d, ack %d, check: %d ", mypktptr->seqnum,mypktptr->acknum, mypktptr->checksum);for (i=0; i<20; i++)printf("%c",mypktptr->payload[i]);printf("");}/* create future event for arrival of packet at the other side */evptr = (struct event *)malloc(sizeof(struct event));evptr->evtype = FROM_LAYER3; /* packet will pop out from layer3 */ evptr->eventity = (AorB) % 2; /* event occurs at other entity */evptr->pktptr = mypktptr; /* save ptr to my copy of packet *//* finally, compute the arrival time of packet at the other end. medium can not reorder, so make sure packet arrives between 1 and 10 time units after the latest arrival time of packetscurrently in the medium on their way to the destination */lastime = time;/* for (q=evlist; q!=NULL && q->next!=NULL; q = q->next) */for (q=evlist; q!=NULL ; q = q->next)if ( (q->evtype==FROM_LAYER3 && q->eventity==evptr->eventity) ) lastime = q->evtime;evptr->evtime = lastime + 1 + 9*jimsrand();/* simulate corruption: */if (jimsrand() < corruptprob){ncorrupt++;if ( (x = jimsrand()) < .75)mypktptr->payload[0]='Z'; /* corrupt payload */else if (x < .875)mypktptr->seqnum = 999999;elsemypktptr->acknum = 999999;if (TRACE>0)printf(" TOLAYER3: packet being corrupted\n");}//if (TRACE>2)//printf(" TOLAYER3: scheduling arrival on other side\n");insertevent(evptr);}//向第五层发送信息/************************** TOLAYER5 ***************/void tolayer5(int AorB,char datasent[20]){int i;if (TRACE>2){printf(" TOLAYER5: data received: ");for (i=0; i<20; i++)printf("%c",datasent[i]);printf("\n");}}三、GBN-CS.c#include "GBN.h"#include <stdio.h>#include <string.h>#include <stdlib.h>extern int TRACE ; /* for my debugging */extern int nsim ; /* number of messages from 5 to 4 so far */extern int nsimmax; /* number of msgs to generate, then stop */extern float time;extern int packet_correct;extern int packet_resent;extern struct event *evlist;int main(){struct event *eventptr;struct msg msg2give;struct pkt pkt2give;int i,j;char c;init();A_init();B_init();while (1){eventptr = evlist; /* get next event to simulate */ if (eventptr==NULL)goto terminate;evlist = evlist->next; /* remove this event from event list */if (evlist!=NULL)evlist->prev=NULL;if (TRACE >= 2){printf("\nEVENT time: %f,",eventptr->evtime);printf(" type: %d",eventptr->evtype);if (eventptr->evtype==0)printf(", timerinterrupt ");else if (eventptr->evtype==1)printf(", fromlayer5 ");elseprintf(", fromlayer3 ");printf(" entity: %d\n",eventptr->eventity);}time = eventptr->evtime; /* update time to next event time*/if (nsim==nsimmax)break; /* all done with simulation */if (eventptr->evtype == FROM_LAYER5 ){generate_next_arrival(); /* set up future arrival *//* fill in msg to give with string of same letter */j = nsim % 26;for (i=0; i<20; i++)msg2give.data[i] = 97 + j;if (TRACE>2){printf(" MAINLOOP: data given to student: ");for (i=0; i<20; i++)printf("%c", msg2give.data[i]);printf("\n");}nsim++;if (eventptr->eventity == A){A_output(msg2give);}else{B_output(msg2give);}}else if (eventptr->evtype == FROM_LAYER3){pkt2give.seqnum = eventptr->pktptr->seqnum;pkt2give.acknum = eventptr->pktptr->acknum;pkt2give.checksum = eventptr->pktptr->checksum;for (i=0; i<20; i++)pkt2give.payload[i] = eventptr->pktptr->payload[i];if (eventptr->eventity == A) /* deliver packet by calling */ A_input(pkt2give); /* appropriate entity */elseB_input(pkt2give);free(eventptr->pktptr); /* free the memory for packet */ }else if (eventptr->evtype == TIMER_INTERRUPT){if (eventptr->eventity == A)A_timerinterrupt();elseB_timerinterrupt();}else{printf("INTERNAL PANIC: unknown event type \n");}free(eventptr);}terminate:printf(" Simulator terminated at time %f\n after sending %d msgs from layer5\n",time,nsim);printf(" correctly sent pkts: %d \n", packet_correct);printf(" resent pkts: %d \n", packet_resent);system("pause");}附源代码及注释四. 实验小结通过本次试验了解了编程实现简单可靠的数据传输GBN协议,模拟了可靠数据传输理解了TCP协议可靠传输的差错检测、重传、累计确认、定时器的可靠传输策略。

相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
2、在配置完上述基本设置后,进入登录界面,如图5所示,输入TSO,回车(键盘上的CTRL键),进入如图6所示的屏幕,输入自己的用户名。
3、修改密码
4、成功登录后应该会看到TSO的主屏,输入ISPF,进入如图8所示界面。
5、创建数据集
在TSO主屏,如图9所示,在红色方框处输入3.2(也可以依次输入3、2)回车(键盘的右CTRL键)。
(5)输入运行的JCL程序,并运行编译结果
(6)控制台方式运行编译程序
一、实验原理
1、大型机数据集的建立
2、COBOL源程序的设计与输入大型机
3、JCL程序的设计与输入大型机
4、编译程序
5、以不同方式运行程序
二、实验目的
1.熟悉PCOM及ISPF环境;
2.熟悉在大机系统编译连接与运行基本COBOL程序的方法;
3.掌握基本是输入输出语句的使用。
三、实验内容
1、连接主机
安装PCOMM软件,点击通信菜单中的配置选项,如图1所示;在定制通信图像界面中,如图2所示,点击链路参数,配置服务器地址:202.115.7.252,端口23,如图3所示;点击会话参数,在主机代码选项中,选择037美国。
6、接下来会进入数据集工具屏,如图10所示,要求输入数据集名称和所在卷标,创建数据集YNTE03.COBOL.SOURCE。注意:YNTE03是我的账号。
如法炮制,使用相同的流程和参数创建数据集YNTE03.COBOL.JCL,其作用存放编译COBOL程序和运行结果程序的JCL程序。
最后,创建存ቤተ መጻሕፍቲ ባይዱ编译结果的数据集YNTE03.COBOL.LOAD,图11是数据集的参数配置图,注意其记录格式为U。
云南大学软件学院实验报告
———————————————————————————————— 作者:
———————————————————————————————— 日期:

云南大学软件学院实验报告
序号:01实验老师:代飞实验时间:2011/10/17姓名:袁秀梅
实验名称:COBOL程序的编译与运行学号:20091120107
3、设计并输入COBOL源程序
在Option处输入4,回车(键盘的右CTRL键),进入数据集查看界面,如图13所示。
图在Option处输入回车,进入如图14所示,并在YNTE03.COBOL.SOURCE中建立一个TEST1的MEMBER,如图中红色方框所示输入,完毕后回车。
图5选择应用程序终端
图6输入用户名
在接下来的屏幕中按提示输入自己的口令,如图7。如果是第一次登陆,必须修改密码。
(1)首先使用由老师分配的IBM的主机用户名和密码登陆大型机
(2)建立相应数据集
建立用于存放COBOL源程序的分区数据集
建立用于存放JCL程序的分区数据集
再根据建立存放编译结果的数据集
(3)设计并输入COBOL源程序
(4)输入编译JCL程序,并编译源程序为目标文件
相关文档
最新文档