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

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

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

程序支持下面的函数调用

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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mixdao.gitbook.io/dfinity/si-.-jiao-cheng/5.-ji-suan-han-shu-zhong-shi-yong-zheng-shu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
