what's function?
-
A number is a number whether binary or decimal. You have to define what you are trying to do before anyone will be able to help.
Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy
-
A number is a number whether binary or decimal. You have to define what you are trying to do before anyone will be able to help.
Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy
-
What is the binary type? Integer? Floating point? By decimal, do you mean a decimal string?
"Go that way, really fast. If something gets in your way, turn."
-
octal is so 1980s. I prefer base 7. :)
"Go that way, really fast. If something gets in your way, turn."
-
led mike wrote:
what about octal
Well I can only count zero and not zero.... so octal is out of my league.... :-)
Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy
-
What is the binary type? Integer? Floating point? By decimal, do you mean a decimal string?
"Go that way, really fast. If something gets in your way, turn."
-
What is the binary type? Integer? Floating point? By decimal, do you mean a decimal string?
"Go that way, really fast. If something gets in your way, turn."
-
What is the binary type? Integer? Floating point? By decimal, do you mean a decimal string?
"Go that way, really fast. If something gets in your way, turn."
#include #include #include using namespace std; int main(void){ string bi = "1010"; //binary int result= 0; for (int i = 0; i< bi.size(); i++){ if (bi[i] == '1'){ result += pow((double)2,(double)bi.size()-i)/2; } } cout << result << endl; return 0; } that should work
-
#include #include #include using namespace std; int main(void){ string bi = "1010"; //binary int result= 0; for (int i = 0; i< bi.size(); i++){ if (bi[i] == '1'){ result += pow((double)2,(double)bi.size()-i)/2; } } cout << result << endl; return 0; } that should work
-
What is the binary type? Integer? Floating point? By decimal, do you mean a decimal string?
"Go that way, really fast. If something gets in your way, turn."
-
string sbin("1011"); char* ptr; long num = strtol( sbin.c_str(), &ptr, 2); cout << num << endl;
-
I see we are having another Fish Fillet special [below] :sigh: :laugh::laugh: I must horizontally challenged ... below above
Last modified: 1hr 25mins after originally posted --
:laugh: That's two mornings in a row I smelled McD's first thing :)
"Go that way, really fast. If something gets in your way, turn."