How to assign specific character N times into a deque in C++

1 Answer

0 votes
#include <iostream>
#include <deque>

using std::cout;
using std::endl;
using std::deque;

int main()
{
	deque<char> dq;

	dq.assign(5, 'w');

	for (char val : dq)
		cout << val << " ";

	cout << endl;

	return 0;
}

/*
run:

w w w w w

*/

 



answered May 4, 2018 by avibootz

Related questions

1 answer 298 views
1 answer 164 views
1 answer 202 views
1 answer 221 views
1 answer 225 views
225 views asked May 4, 2018 by avibootz
1 answer 186 views
1 answer 197 views
...