Y
yogi_bear_79
Below is a snippet of code that works for me. Currenlty it populates
my vector with one digit per element. I would like to modify this
code to populate each element of the vector with 3 digits from the
string.
(i.e. 179,534,672,198 would be stored with block [0] = 198, block [1]
= 672, block [2] = 534, and block [3] = 179)
vector<int> vOne, vTwo;
string one, two;
size_t r;
cout << "\n\n\t Please enter the first integer:\t";
cin>>one;
r = one.length();
for (int x = 0; x < r; x++){
vOne.push_back(int(one[x] - '0'));
}
my vector with one digit per element. I would like to modify this
code to populate each element of the vector with 3 digits from the
string.
(i.e. 179,534,672,198 would be stored with block [0] = 198, block [1]
= 672, block [2] = 534, and block [3] = 179)
vector<int> vOne, vTwo;
string one, two;
size_t r;
cout << "\n\n\t Please enter the first integer:\t";
cin>>one;
r = one.length();
for (int x = 0; x < r; x++){
vOne.push_back(int(one[x] - '0'));
}