The user inputs a text, then I check whether that string can be divided by 8
if(text.length()%8==0)
If yes, I take the quotient.
int sk = text.length()/8;
And so I need to take each 8 symbols from that sentence and convert to a new different symbol. For example if the sentence is 1234567890123456 it has to be divided to 2 different symbols. 12345678 = A and 90123456 = B
To do that I know I should use for loop
I’ve done this:
if(text.length()%8==0){
sk = text.length()/8;
for(int m=1;m<=sk;m++){
//change the text
}
}
So, my question is, what to write down in that for loop in order to see the desired results?
-Thank you
You can use the
replacemethod fromstd::string:Of course there are some checks you’ll need to perform.