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 419 views
1 answer 259 views
1 answer 303 views
1 answer 347 views
1 answer 299 views
299 views asked May 4, 2018 by avibootz
1 answer 282 views
1 answer 303 views
...