Please explain what is the error

don’t use append
either directly print or use character array
because append take const string or const char* as parameter
so this will not work here

for append read this
https://www.cplusplus.com/reference/string/string/append/

you can use push_back() function as well

@asaurabh_26
so the datatype of variable shall be string or we shall write " " . right?

data type is string in your case as well

use push_back()

@asaurabh_26
how to use push_back

pls give small example code

instead of append use push_back();
push_back() insert the string at back(end)

Modified Code

@asaurabh_26
Does push_back() works for all type of containers ?

Also are there to_int or other such () like to_string ?

NO, every containers has it’s own

yes there are lot’s of other but i use to_string()

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.