How to change a 2-Dimensional Vector of type char into a a 2-Dimensional Vector of type string | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to change a 2-Dimensional Vector of type char into a a 2-Dimensional Vector of type string

I'm working on a program the requires a 2D Vector of type char to be changed into a 2D Vector of type string. However, I am not sure how I can do it...

15th Jun 2018, 12:33 PM
Edwin Pratt
Edwin Pratt - avatar
2 Answers
+ 1
if it still stays 2d wouldn't that just mean converting every char into a string? seems kinda pointless. if what you mean is turning each vector of characters into a single string, and then making a 1d vector of those, that can be done by iterating through each one, appending the characters to a string, and then adding that into a separate string vector
15th Jun 2018, 3:23 PM
hinanawi
hinanawi - avatar
+ 1
hinanawi Thanks. I understand now...
15th Jun 2018, 3:24 PM
Edwin Pratt
Edwin Pratt - avatar