Check out example codes for "convert binary to decimal c++ stl". It will help you in understanding the concepts better.

Code Example 1

string bin_string = "10101010";
int number =0;
number = stoi(bin_string, 0, 2);
// number = 170

Learn ReactJs, React Native from akashmittal.com