摘要: #include <iostream>#include<iomanip>#include <string>#include <sstream>#include<queue>using namespace std;bool fun(char a){ if(a=='*'||a=='/') return true; return false;}double fun1(double i,double j,char a){ if(a=='*') return i*j; else if(a== 阅读全文
posted @ 2013-02-25 19:47 叶城宇 阅读(403) 评论(0) 推荐(0) 编辑
摘要: #include "stdafx.h"#include<iostream>using namespace std;#include<fstream>#include<string>typedef struct {char date; int weight; int parent,lchild,rchild;}Htnode,*huffmanTree;typedef char* * huffmancode;void fun(Htnode *p,char a,int b){ p->date=a; p->weight=b; p-> 阅读全文
posted @ 2013-02-25 19:44 叶城宇 阅读(399) 评论(0) 推荐(0) 编辑
摘要: //二叉树的基本操作#include<iostream>using namespace std;typedef char Telemtype;typedef struct bitnode { Telemtype date; int mark; bitnode *lchild,*rchild;}*bitree;int initbitree(bitree &T){ T=NULL; return 1; } int createbitree (bitree &T){ //按先序次序输入二叉树中节点的值(一个字符),空格字符表示空树; //构造二叉树表表示的二叉树T. cha 阅读全文
posted @ 2013-02-25 19:39 叶城宇 阅读(177) 评论(0) 推荐(0) 编辑
摘要: //链表栈#include "stdafx.h"#include<iostream>using namespace std;typedef struct{ int line; int count; int dir;}Elemtype;typedef struct s{ Elemtype elem ; s* next; }s;//链表栈的结点类型为结构体;void initstack(s*&base){ base=(s*) malloc (sizeof(s)); base->next=NULL;}void push(s*&base ,Elem 阅读全文
posted @ 2013-02-25 19:37 叶城宇 阅读(241) 评论(0) 推荐(0) 编辑
摘要: //循环链表.h#include "stdafx.h"#include<iostream>using namespace std;typedef int Elemtype[2] ;typedef struct l { Elemtype elem; struct l* next;}l;//链表的结点类型为结构体;l* r,*f;bool initlist(l*&a){ a=(l*)malloc(sizeof(l)); if(!a)return false; (*a).next=a;r=a;f=a; return true;}//键头结点;void link 阅读全文
posted @ 2013-02-25 19:34 叶城宇 阅读(174) 评论(0) 推荐(0) 编辑
摘要: include irvine32.inc.dataa byte "abhgfu s women"b byte sizeof a dup(0).codemain proc;打印出字符串;mov edx,offset acall writestringcall crlfmov esi,offset amov edi,offset bmov ecx,(sizeof a)add esi,(sizeof a)-1mov eax,0L1: mov al, byte ptr [esi] mov [edi], eax inc edi dec esi LOOP L1mov edx ,offs 阅读全文
posted @ 2013-02-25 19:18 叶城宇 阅读(166) 评论(0) 推荐(0) 编辑
摘要: include irvine32.inc.dataarray dword 10000h,20000h,30000h,20000h,10000hthesum dword ?.codearraysum proc push esipush ecxmov eax,0L1: add eax,[esi] add esi,type dword LOOP L1 pop ecx pop esi retarraysum endp main proc mov esi,offset array mov ecx,lengthof array call arraysum mov thesum,eax call wri.. 阅读全文
posted @ 2013-02-25 19:17 叶城宇 阅读(132) 评论(0) 推荐(0) 编辑
摘要: include irvine32.inc.datai dword 1,2,34,5,6,7,8,9,0,11.codemain procmov ecx,0;mov esi,offset imov ecx,lengthof i;;mov eax,ecx;;call writeint;call crlfmov ebx,dword;call dumpmem;exitmain endpend main 阅读全文
posted @ 2013-02-25 19:16 叶城宇 阅读(164) 评论(0) 推荐(0) 编辑
摘要: include irvine32.incstandard=2000;.dataday word 15;month word 5;year word 2012;ymd word ?.codemain procmov eax,0;mov ebx,0;mov ax,year;sub ax,standard;shl ax,9;mov bx,month;shl bx,5;add ax ,bx;add ax,day;mov ymd,ax;call writebin;exitmain endpend main 阅读全文
posted @ 2013-02-25 19:15 叶城宇 阅读(107) 评论(0) 推荐(0) 编辑
摘要: include irvine32.inc.datatime word 0101011000111001bhh word ?mmm word ?sss word ?.codemain procmov eax,0;mov ax,time;shr ax,11;mov hh,ax;call writedec;mov al,':'call writechar;mov ax,time;shr ax,5;and ax,111111b;mov mmm,ax;call writedec;mov al,':'call writechar;mov ax,time;and ax,111 阅读全文
posted @ 2013-02-25 19:14 叶城宇 阅读(95) 评论(0) 推荐(0) 编辑
摘要: include irvine32.inc.datastr1 byte "赋值后的结果:",0;.codemain proccall swap;;mov ebx,offset str1;;call writestring;exitmain endpswap procpush ebp;mov ebp,esp;sub esp,32;mov ecx,29;mov eax,ebp;L1: mov byte ptr [eax-32],'@'; inc eax; loop L1; mov byte ptr[eax-32],0 mov edx,offset str1; ca 阅读全文
posted @ 2013-02-25 19:13 叶城宇 阅读(202) 评论(0) 推荐(0) 编辑
摘要: include irvine32.incchang proto ,v1:ptr dword,v2: ptr dword.datai dword ?j dword ?str1 byte "交换前的是:",0;str2 byte "交换后的结果:",0;.codemain proccall readintmov i,eax;call readintmov j,eax;mov edx,offset str1call writestring;mov eax,i;call writeint;mov al,','call writecharmov e 阅读全文
posted @ 2013-02-25 19:12 叶城宇 阅读(127) 评论(0) 推荐(0) 编辑
摘要: include irvine32.incsub2 proto a:ptr dword,l1:dword.datai dword 10 dup(?);str1 byte "开始初始化的值:",0;.codemain procmov edx,offset str1;call writestringinvoke sub2 ,offset i,lengthof i;call crlf;mov esi,offset i;mov ecx,lengthof i;mov ebx,dword;call dumpmem;exitmain endpsub2 proc, a:PTR dword, 阅读全文
posted @ 2013-02-25 19:11 叶城宇 阅读(254) 评论(0) 推荐(0) 编辑
摘要: include irvine32.inc.datai dword 8j dword 29x dword 0.codemain proc mov eax,0L: cmp i,10 jl L1 cmp j,15 jng next ;call writeint ;call crlfL1: inc i dec j inc x LOOP Lnext:mov eax,xcall writeintexitmain endpend main 阅读全文
posted @ 2013-02-25 19:09 叶城宇 阅读(150) 评论(0) 推荐(0) 编辑
摘要: ;功能:查找32位之间的赋值语句是否有语法错误,如果没有就输出,如果有就输出错误;;为了减少情况判断;特意规定mov后面的第一个参数必须为寄存器。;赋值语句中32位赋值和16位、8位等情况的赋值语法完全相同,;所以这里只判断32位赋值的情况,并且假设这里的内存操作数一定是写对的;用str1来存储要判断的语句,用str2来存储内存操作数的类型。include irvine32.inc.datai dword 1;c1 byte "改语法不正确:",0;c2 byte "相等",0;c3 byte "该语法正确",0;c4 byte &q 阅读全文
posted @ 2013-02-25 19:08 叶城宇 阅读(156) 评论(0) 推荐(0) 编辑
摘要: include irvine32.inc;.datai dword 0;sum qword 0;str1 byte "请输入16进制的(32位整数)乘数和被乘数",0str2 byte "乘积为:",0;j dword 0;.codemain procL1: mov edx,offset str1; call writestring; mov j,0; mov eax,0;eax为(低32位)乘积值; mov ebx,0;edx为(低32位)乘积值的中间值 mov edx,0; mov esi,0;dsi为(高32位)乘积值的中间值 mov edi,0; 阅读全文
posted @ 2013-02-25 19:07 叶城宇 阅读(514) 评论(0) 推荐(0) 编辑
摘要: include irvine32.inc.datastr1 byte "请输入所要的斐波那序列的位置:",0;str2 byte "斐波那序列的结果为:",0;str3 byte "斐波那序列的最大值为N=",0;i dword 2;var1 dword 3 dup(1,0,0);var2 dword 3 dup(1,0,0);.codemain proc mov ecx,0; mov eax,0;L1: mov var1,1; mov dword ptr var1+4,0; mov dword ptr var1+8,0; mov v 阅读全文
posted @ 2013-02-25 19:06 叶城宇 阅读(223) 评论(0) 推荐(0) 编辑
摘要: include irvine32.inc.datavar1 dword 4 dup(0,0,0,0);str1 byte "请用16进制输入一个大整数(最高位为96位)",0;str2 byte "结果为:",0;str3 byte "请输入2的次方数(十进制--不能超过31):",0;i dword 0;j dword 0;str4 byte "输入的绝对值为:",0.codemain procL4: mov dword ptr var1+12,0; mov j,0;正负数的标志;0为正数,1为负数; mov e 阅读全文
posted @ 2013-02-25 19:03 叶城宇 阅读(285) 评论(0) 推荐(0) 编辑