I have code that converts a string into binary, but I want to be able to store that binary code in a vector, but of course I can only store ints in a vector. How can I convert bitset to int?
1 2 3 4 5 6 7 8 9 10 11 12 13
I have code that converts a string into binary, but I want to be able to store that binary code in a vector, but of course I can only store ints in a vector. How can I convert bitset to int?
[code]
int toBinary(string myString) {
int binary_outputInformations;
for (std::size_t i = 0; i < myString.size(); ++i) {
cout << bitset<8>(myString.c_str()[i]) << endl;
}
question.push_back(bitset<8>(myString.c_str()[i]));
return 0;
}
[code/]