Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
what are the input cases for the following requirement (should cover boundary values and equivalence class):
X can take values from 0 to 100 where X is a signed 8 bit integer.
Input values for a boundary test case in this case are -1, 0, 100, 101.
If X is unsigned then the "equivalent class" boundary test case should have as input: 0, 100, 101.
I am not sure if you want to the test the boundaries of number representation, in this case 8 bits. So you should also test for signed 127 or 128 and unsigned 255. But it depends on representation of the signed numbers .
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 17 days ago.
Improve this question
Sorry, maybe my explanation is not understandable (edit).
enter image description here
in the figure, to shorten the number, we use scientific notation, but shouldn't we use
a x 10^n
however in the image, using
a x 2^n
why use base 2.
isn't it if we add base 10 the right answer
this is the result if i use
a x 2^n
enter image description here
(it is not in accordance with)
this is the result if i use
a x 10^n
enter image description here
Thankyou for answer
In base 10, 1.010101001d x 10d^6 = 1010101.001d
In base 2, 1.010101001b x 10b^6 = 1010101.001b (but 10b = 2d)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
How does this work?
int a=5<=5;
cout<<a; // output : 1
Who can explain why output is 1?
That's because
<= has higher priority than = so it is calculated first.
5 <= 5 returns a boolean, which is true.
It is converted into an integer, which is 1.
then 1 is assigned to a.
so a equals 1 now.
5<=5 is true which, when converted to an integer is 1.
You assign this value to a which then holds the value 1. Which you then output.
You may want to read https://en.cppreference.com/w/cpp/language/operator_precedence
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
How show 00156,00
float number = 156;
printf("%5.2f",number);
The output of the example above:
Output: 156.00
You need to pass the 0 flag for leading zeros, and the field width must be wide enough to have any leading characters printed. So you might try this:
printf("%08.2f", number);
The . verses , (aka, the "radix character") is determined from the LC_NUMERIC portion of the locale. See man setlocale for information on setting this programatically.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am extremely new to C++ so I'm probably asking a very trivial question, but if you could help that'd be great!
I have an array[n].
Indexed from 0 to some unknown value.
I need to access the index of the array, the n value but I need to do so in binary. I am intending to do a bit reversal on it.
So, if I have an array of 2048 points how do I represent the 1024 array in binary?
If you want to write a value in binary, you can do so in C++14 with
int my_binary_value = 0b01010101;
If you'd like to test a specific bit of an int, you can do that by masking it, i.e.
bool is_bit_4_set = my_binary_value & 0b00001000;
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
For a study I am doing everyone gets assigned a unique number.
All unique numbers are divisble by 11 (this is done because it makes sequential numbers quite different from each other).
I would ideally like a regex which I can use to check that the number entered in the study_id field is an acceptable value - e.g divisible by 11.
I will have leading zeroes to a maximum of 5 digits
So:
00011 - Acceptable
00012 - Not Acceptable
13211 - Acceptable
13221 - Not Acceptable
Any suggestions gratefully received
This isn't possible because there are no textual similarities between numbers that are divisible by 11. Regex is used for text matching.
For example 000165 is divisible by 11 as is 00011.
The best way to validate the number is to divide it by 11 and see if there is any remainder. So in Excel you'd do this:
=IF(MOD(165, 11) = 0, "VALID", "INVALID")
Or C# you'd do something like this
bool isValid = 165 % 11 == 0;
(Disclaimer I'm not familiar with ODK so I can't provide a suitable sample; I've just guessed on the best language to write in)