Код: Выделить всё
std::cin >> str;
for ( char c : str )
if ( c == 'b' ) vector.push_back(i) //while i is the index of c in str
Подробнее здесь: https://stackoverflow.com/questions/151 ... d-for-loop
Код: Выделить всё
std::cin >> str;
for ( char c : str )
if ( c == 'b' ) vector.push_back(i) //while i is the index of c in str