提交 8d7d68e3 创建 作者: 赵鹏翀's avatar 赵鹏翀

init template

上级
/Debug
/Release
<?xml version="1.0" encoding="gb2312"?>
<ASMProject Version="1.00" Name="Lab007" TemplatePath="console(c)\Project" ProjectID="aaff8ff8-c45a-417a-ba83-c702f832f9ab" IsSubmitWork="0">
<Configurations>
<Configuration Name="Debug" DebuggerFlavor="0">
<Tool Name="PreBuildEventTool"/>
<Tool Name="CustomBuildTool"/>
<Tool Name="GCCCompilerTool" PreprocessorDefinitions="_DEBUG" GenerateDebugInformation="-1" LanguageStandard="c99"/>
<Tool Name="PreLinkEventTool"/>
<Tool Name="GCCLinkerTool"/>
<Tool Name="PostBuildEventTool"/>
</Configuration>
<Configuration Name="Release" DebuggerFlavor="0">
<Tool Name="PreBuildEventTool"/>
<Tool Name="CustomBuildTool"/>
<Tool Name="GCCCompilerTool" PreprocessorDefinitions="NDEBUG" LanguageStandard="c99"/>
<Tool Name="PreLinkEventTool"/>
<Tool Name="GCCLinkerTool" StripDebugInfo="-1"/>
<Tool Name="PostBuildEventTool"/>
</Configuration>
</Configurations>
<Files>
<Filter Name="ͷļ" Filter="h;hpp;hxx">
<File RelativePath=".\console.h">
</File>
</Filter>
<Filter Name="Դļ" Filter="cpp;c;cc;cxx">
<File RelativePath=".\asmfun.s">
</File>
<File RelativePath=".\console.c">
</File>
</Filter>
</Files>
</ASMProject>
添加文件
.globl _asmfun
#******************************************************************************
_asmfun:
#在此处将汇编代码补充完整
#程序的功能是:根据用户选择的功能号,调用不同的子函数,计算输入数据的平方或者立方
L3:
ret #asmfun函数返回
#******************************************************************************
#在此处编写求平方子函数
#******************************************************************************
#在此处编写求立方子函数
\ No newline at end of file
#include "console.h"
int Optr1; // 定义全局变量
int funcNum; // 选择功能号
int Result; // 保存计算的结果
unsigned long asmfun(); // 声明函数asmfun()
int main(int argc, char* argv[])
{
// 保存输入数据保存
printf("请输入一个数据\n");
scanf("%d", &Optr1);
printf("请选择功能\n1.求平方 2.求立方\n");
scanf("%d", &funcNum);
// 调用函数asmfun()
asmfun();
// 显示出计算结果
if(funcNum == 1)
{
printf("求出的%d的平方是:%d\n", Optr1, Result);
}
else if(funcNum == 2)
{
printf("求出的%d的立方是:%d\n", Optr1, Result);
}
else
{
printf("选择的功能不存在\n");
}
return 0;
}
#ifndef _CONSOLE_H_
#define _CONSOLE_H_
#include <stdio.h>
/* TODO: 在此处引用程序需要的其他头文件 */
#endif /* _CONSOLE_H_ */
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论