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 152 views
3 answers 246 views
1 answer 150 views
1 answer 153 views
...