> For the complete documentation index, see [llms.txt](https://mixdao.gitbook.io/dfinity/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mixdao.gitbook.io/dfinity/si-.-jiao-cheng/5.-ji-suan-han-shu-zhong-shi-yong-zheng-shu.md).

# 5.计算函数中使用整数

本章节中会编写一个简单的计算器程序，程序会创建一个actor，actor有几个执行计算操作的公共函数。

actor命名为Calc。程序使用cell变量来代表计算操作结果。

程序支持下面的函数调用

* add函数接受输入并执行加法
* sub函数接受输入并执行减法
* mul函数接受输入并执行乘法
* div函数接受输入并执行除法
* clearall函数清空存储前一个操作结果的变量cell，重置cell值到0

div函数也包含阻止程序除零的代码。
