为什么0 mod 0是错误? [英] Why is 0 mod 0 an error?

查看:302
本文介绍了为什么0 mod 0是错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我输入:

int main() { return 0 % 0; }

我得到一个错误:

error C2124: divide or mod by zero

这背后的原因是什么?答案不是零吗?

What is the reason behind this? Isn't the answer zero?

推荐答案

在数学中,x mod 0是未定义的,因此是错误的.

In mathematics, x mod 0 is undefined, hence the error.

这篇关于为什么0 mod 0是错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆