C0扩充文法编译器测试报告.doc
《C0扩充文法编译器测试报告.doc》由会员分享,可在线阅读,更多相关《C0扩充文法编译器测试报告.doc(19页珍藏版)》请在三一办公上搜索。
1、C0扩充文法编译器测试报告学号:_37230118_姓名:_罗杨_2010年 1月 16日1测试样例一(正确)测试样例int fib(int k)if (k=0)return (1);if (k=1)return (1);return (fib(k-1)+fib(k-2);void main()int n,result;printf(Please enter n: );scanf(n);printf(Fib(n) is: );result=fib(n);printf(result);return ;程序输出输入一个数字,输出其斐波那契数目标代码.386.model flat,stdcallop
2、tion casemap:noneincludeC:RadASMMasm32includewindows.incincludeC:RadASMMasm32includekernel32.incincludeC:RadASMMasm32includemsvcrt.incincludelib C:RadASMMasm32libmsvcrt.libincludelib C:RadASMMasm32libkernel32.libincludeC:RadASMMasm32includemacros.asm.datapiequ40490FCFh.codefibprocpushebpmovebp,espsu
3、besp,100hmoveax,dword ptr ebp+08hcmpeax,0jnelabel0_1movdword ptr ebp-04h,1jmplabel0_2label0_1:movdword ptr ebp-04h,0label0_2:cmpdword ptr ebp-04h,0jzl1moveax,1addesp,100hpopebpret04hl1:moveax,dword ptr ebp+08hcmpeax,1jnelabel1_1movdword ptr ebp-08h,1jmplabel1_2label1_1:movdword ptr ebp-08h,0label1_2
4、:cmpdword ptr ebp-08h,0jzl2moveax,1addesp,100hpopebpret04hl2:moveax,dword ptr ebp+08hsubeax,1movebx,eaxmoveax,ebxpusheaxcallfibmovdword ptr ebp-010h,eaxmoveax,dword ptr ebp+08hsubeax,2movebx,eaxmoveax,ebxpusheaxcallfibmovdword ptr ebp-018h,eaxmoveax,dword ptr ebp-010haddeax,dword ptr ebp-018hmovebx,
5、eaxmoveax,ebxaddesp,100hpopebpret04hfibendpstart:pushebpmovebp,espsubesp,100hinvokecrt_printf,SADD(Please enter n: )invokecrt_scanf,SADD(%d),addr dword ptr ebp-04hinvokecrt_printf,SADD(Fib(n) is: )moveax,dword ptr ebp-04hpusheaxcallfibmovdword ptr ebp-0ch,eaxmoveax,dword ptr ebp-0chmovdword ptr ebp-
6、08h,eaxinvokecrt_printf,SADD(%d),dword ptr ebp-08haddesp,100hpopebpinvokeExitProcess,NULLaddesp,100hpopebpinvokeExitProcess,NULLendstart执行结果正确2测试样例二(正确)测试样例void main()int i,n,sum,sum2,temp;printf(Please enter the total count:);scanf(n);sum=0;sum2=0;for ( i=0; i= a * 5)c = c + 2;a = a * 2;d = d - 4;e
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C0 扩充 文法 编译器 测试报告
链接地址:https://www.31ppt.com/p-3022301.html