Can we multiply string with and int n in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can we multiply string with and int n in c++

As in python we multiply an integer n to a string to make it print n times. Can we do the same in c++ in any easy way? I know we can do it using some loop but is there any other simple way?

29th Oct 2018, 6:43 PM
Shivam Gavandi
Shivam Gavandi - avatar
1 Answer
0
You always can override different operators to implement necessary functionality. Just pass int and string values to it and get what you want
29th Oct 2018, 9:00 PM
microBIG
microBIG - avatar