23
answers
2
watching
313
views

Shorter and more consistent. Binary or base two system only allows zeros and ones, for example the number 255 in decimal system is equivalent to eight ones in the binary system. Hexadecimal numbers contain the digits 0 to 9 as well as the letters a to f, making it easier to deal with large decimal or binary numbers.

When working with numbers, it is important to understand the concept of narrowing; this happens when a variable of a smaller type is initialized with a larger type. As we store a smaller number in the larger memory space, we don't have to worry about data loss as the additional bytes in memory are filled with zeroes. Although these numbers are not truly random, they are based on some kind of mathematical formula. To generate random numbers, we can use the 'srand' (seed rand) function, which will give us two random values between one and six. To limit the range of this random number, we can use the formula shown onscreen; though this method is more complicated and not suitable for beginners, it is still a good way to learn how to generate random numbers - for example, to roll a dice.

For unlimited access to Homework Help, a Homework+ subscription is required.

Avatar image
Liked by pandeyshyam238 and 2 others

Unlock all answers

Get 1 free homework help answer.
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Avatar image
Read by 1 person
Already have an account? Log in
Avatar image
Read by 1 person
Already have an account? Log in
Avatar image
Read by 1 person
Already have an account? Log in
Avatar image
Read by 1 person
Already have an account? Log in
Avatar image
Read by 1 person
Already have an account? Log in
Avatar image
Read by 1 person
Already have an account? Log in
Avatar image
Read by 1 person
Already have an account? Log in
Avatar image
Read by 1 person
Already have an account? Log in

Related questions

Related Documents

Weekly leaderboard

Start filling in the gaps now
Log in