#include/* This function takes a binary string and returns the decimal equivalent using the Positional notation method. */ __int64 binToDec(char *binStr) { __int64 pow = 1, dec = 0; for (int i = strlen(binStr)-1; i >= 0; i--) { dec += (binStr[i] == '1') ? pow : 0; pow *= 2; } return dec; } int main() { std::cout << binToDec("1010"); std::cin.get(); return 0; }
butts
ReplyDeletehttp://kadams133.blogspot.com/
I was never good at programming.
ReplyDeleteBigLoser, that's a bit pessimistic, you may be surprised how good you are, just find some project that you enjoy doing.
ReplyDeleteYooooooo
ReplyDeletehttp://kadams133.blogspot.com/