how can i solve binary system in c++? [closed] - c++

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
how can i see the answer when i need to solve the decimal code to binary code?

decimal code to binary code? i think that you mean decimal number to binary number, so use std::bitset e.g.
#include <bitset>
...
int i = 49;
std::cout << std::bitset<sizeof(i)*8>(i).to_string() << std::endl;

Related

Execution Control In C [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I was solving a problem where i was asked to output the list of numbers satisfying certain conditions. The score awarded depended upon the size of the output ( as it is a partial marking question). How do i restrict my code to keep outputting the numbers till it does hits the time limit.
It seems like the obvious structure would be something like this:
while (current_time < end_time) {
current_number = *next_number++;
if (meets_conditions(current_number))
output(current_number);
}

I want regex for int<any no of spaces>,<any no of spaces>int<any no of spaces>,<any no of spaces>int [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
and there are exactly 3 integers. No floats allowed. No characters allowed. Just integers.
The pattern for that is this: \d+\s*,\s*\d+\s*,\s*\d+
Matches three digits with any number of spaces

C++ float exceptions [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I make some calculation of float numbers in my application. In some cases I got such numbers as -1.#J and 1.#R. What does this mean?
-1.#J is either NaN or inf: What does floating point error -1.#J mean?
1.#R is underflow (exponent too small): http://www.windows-api.com/microsoft/VC-Language/31121018/1r-result-from-floating-point-arithmetic.aspx

How to force two decimal places to the right using C++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm new to C++ programming. I want to know how I can input any numbers such as 1256 or 2523 and have the output read as 12.56 or 25.23?
Basically what I want is for the last two digits to appear on the right side of the decimal.
float value = input / 100.0f;
// C way
printf("%.2f\n", value);
// C++ way
cout << setiosflags(ios::fixed) << setprecision(2) << value << endl;

How would you define infinity? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Expand your thoughts upon this:
#define INFINITY ((1 << (8*sizeof (int) - 6)) - 4)
Is expanded?
Why not
numeric_limits<float>::infinity()
or
numeric_limits<double>::infinity()
?
Use numeric_limits from <limits> header file, as
numeric_limits<float>::infinity()
See this : http://www.cplusplus.com/reference/std/limits/numeric_limits/