Nono34 Asked: 2022-09-04 15:09:20 +0800 CST 2022-09-04 15:09:20 +0800 CST 2022-09-04 15:09:20 +0800 CST How do I make "* " print as many times as I want without using a for? Something like using a string(n, '*') 772 This is basically the problem, I want to repeat a string several times without using a lot of space, that's why I say without using a for. c++ 1 Answers Voted Best Answer fluxxx 2022-09-04T16:30:31+08:002022-09-04T16:30:31+08:00 For the sake of simplicity, you can use a while for your method logic. while(n-- > 0) { cout << "*" }
For the sake of simplicity, you can use a while for your method logic.