rand (& round) functions do not work as expected
Posted: Mon Mar 07, 2011 6:56 pm
hi,.... how's it going,
when i try to generate a random number with the rand function,
all i get is a decimal. i know there must be a way to round it up to a whole number and NOT
a decimal. below is the source i tried to use but i suppose the source code is not correct.
or perhaps i dont have much knowledge in how to code it correctly thru C/C++ to make it
effectively usable with a key down event (which is what i mainly wish it to be activated by).
the ways i tried to make it work:
* num1.textNumber=rand(20);
* num1.text=rand(20) ..........returns error (cannot convert from double to ARY[256]CHAR)
* num1.textNumber=num1.textNumber*rand(20);
so if someone who is more knowledgable could point me in the right direction as to solve this problem
i'd be ever so grateful. i could even appreciate it if someone could show me some links to some compatible
C/C++ info to allow me to understand coding in a C/C++ manner since working it up in a visual type way isn't
cutting the mustard. i wish there would seriously be a place where i could look & understand everything i
need to know to accomplish what i want with this & even other programmatic things in life. it's so frustrating......
when i try to generate a random number with the rand function,
all i get is a decimal. i know there must be a way to round it up to a whole number and NOT
a decimal. below is the source i tried to use but i suppose the source code is not correct.
or perhaps i dont have much knowledge in how to code it correctly thru C/C++ to make it
effectively usable with a key down event (which is what i mainly wish it to be activated by).
the ways i tried to make it work:
* num1.textNumber=rand(20);
* num1.text=rand(20) ..........returns error (cannot convert from double to ARY[256]CHAR)
* num1.textNumber=num1.textNumber*rand(20);
so if someone who is more knowledgable could point me in the right direction as to solve this problem
i'd be ever so grateful. i could even appreciate it if someone could show me some links to some compatible
C/C++ info to allow me to understand coding in a C/C++ manner since working it up in a visual type way isn't
cutting the mustard. i wish there would seriously be a place where i could look & understand everything i
need to know to accomplish what i want with this & even other programmatic things in life. it's so frustrating......