Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 10-03-2000, 01:43 PM   #1
Member (10 bit)
 
Join Date: May 1999
Location: Orlando, FL
Posts: 975
Send a message via ICQ to artsapimp
I have fixed the cdo problem but now have a really easy one. I am trying to get an average of 5 numbers but want it to round to the nearest whole number. How would I do that in ASP?

IE - 906 instead of 906.45234253243532645.

Thanks
artsapimp is offline   Reply With Quote
Old 10-03-2000, 06:36 PM   #2
Member (9 bit)
 
Join Date: Dec 1999
Location: Midland, NC, USA
Posts: 292
VBscript, right?
You gotta coerce it to use integers. Depending on the browser, version of IIS, hair color, phase of the moon, etc, forcing one just one of the numbers in the equation may still give you, er, unreliable results.

Start out with cint(avg) = total / five to force the result to an integer.

Or you could go whole-hog and use
cint(avg) = cint(total) / cint(five) ("five" is a variable, by the way)

This will convert all three terms in the equation to integers.
UncaDanno is offline   Reply With Quote
Old 10-05-2000, 06:00 PM   #3
Member (6 bit)
 
Join Date: Aug 2000
Posts: 39
Send a message via ICQ to doltish
Well I know that in C you simply have to initialize your variable as int to store an integer...but somehow I doubt VB uses the same method.
doltish is offline   Reply With Quote
Old 10-05-2000, 06:09 PM   #4
Member (10 bit)
 
Join Date: May 1999
Location: Orlando, FL
Posts: 975
Send a message via ICQ to artsapimp
I'm sorry for not responding earlier, but UncaDonna was correct. What I was missing was setting the integer first, then taking the Cint(x) of it. That worked. Thanks.
artsapimp is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 05:50 AM.
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.0