how to generrate array of integers (exact same every time)? [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am trying to generate array of integers within specific limit using random number generator but I want exact same array every time .

Seed your generator with the same seed value every time and it will produce the same sequence of numbers (true for most generators).

Related

writing c++ program "fraction of double" [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I wanna write a c++ program that read a double value and after reading it print only the fraction of that number, for example if the input was 14.25 then the output must be 0.25
should include iomanip to it?
One approach would be to
Round the number down to the nearest integer - you can use the floor() function (http://www.cplusplus.com/reference/cmath/floor/)
Subtract that integer from the original number to get the result

generating random int input from -100 to 100 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I want to generate random numbers between -100 to 100 however i am not sure which of these will generate the right numbers
rand()%201 - 100; or rand()%200 - 100;
The first one, rand()%201 - 100.
The second one will never hit positive 100, as rand()%200 will never be 200.

How to convert a large binary number to decimal? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am facing a problem. The maximum binary number I am able to convert is 1000000000000000000. Is there any way to convert a binary number larger than this?
There is a function called strtoull (string to unsigned long long integer) which should work, follow the link for an example. https://en.cppreference.com/w/cpp/string/byte/strtoul

Turning a string that contains a equation into an integer [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I would like to be able to convert a string such as "(5+6)*6" and get the resulting integer from that equation. It is important that it starts out as a string.
You can use library fastmathparser for c++.
In link is example how use this library.
If you really want write alone this parser, I recomended use Shunting-yard algorithm

How do programmers add huge values such as those seen in RC5/RC6 encryption [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
So as part of RC6 encryption, the key size can be up to 256 bytes and operations are performed on the key throughout the encryption process. How do programmers store such huge values and perform operations on them? Specifically in C++?