How to initialize string by character with number of occurrence in C++

1 Answer

0 votes
#include <iostream>
#include <string>

using std::cout;
using std::endl;
using std::string;

int main()
{
	string s(7, '*');

	cout << s << endl;

	return 0;
}

/*
run:

*******

*/

 



answered May 7, 2018 by avibootz

Related questions

1 answer 164 views
1 answer 238 views
3 answers 386 views
1 answer 240 views
1 answer 220 views
...