本文介绍了值超过 100,000+ 时 Cint 溢出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是编程新手,遇到了 Cint 溢出错误的问题.每当值达到 100,000+ 时,我就会收到 Cint 溢出错误.这是我在编程课程介绍中的练习.据我所知,我完全按照实践中的方式对其进行了编码,但实践表明使用了高达 300,000 的值.有人可以解释一下我可能做错了什么吗?
I am brand new to programming and am running into some trouble with Cint overflow error. Whenever the value reaches 100,000+ I get a Cint overflow error. This was a practice exercise in my intro to programming class. As far as I can see I coded it exactly how it was done in practice, but the practice shows using values as high as 300,000. Can someone possibly explain what I might be doing wrong?
<script language="VBscript">
Option Explicit
DIM numberofshifts, totalshift1, totalshift2, _
totalshift3, grandtotal, shiftaverage
numberofshifts=3
totalshift1 = Inputbox("How many widgets during the first shift")
totalshift2 = Inputbox("How many widgets during the second shift")
totalshift3 = Inputbox("How many widgets during the third shift")
grandtotal = cint(totalshift1) + totalshift2 + totalshift3
shiftaverage = grandtotal / numberofshifts
Document.write "The Total of the Three Shifts is " & grandtotal
Document.write "<br>The Average of the Three Shifts is " & shiftaverage
</script>
推荐答案
CInt
可以处理 -32,768 和 32,767 之间.
CInt
can handle betweeen -32,768 and 32,767.
使用 CLng
而不是 CInt
.
这篇关于值超过 100,000+ 时 Cint 溢出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!