summaryrefslogtreecommitdiff
path: root/9p22.cpp
blob: 90a7f924a61bd88dc07e572ea5b6bd0d6e9836d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <vector>

/*
 *
 * 9.22
 *
 * I don't know what the author intends for the program to do.
 * It may be obvious to the author but if he does tell me then
 * it could be anything.
 */

int main () {

	int some_val = 0;
	std::vector<int> iv = {1,2,3,4,5,6,7,8};
	std::vector<int>::iterator iter = iv.begin(),
		mid = iv.begin() + iv.size()/2;
	while (iter != mid)
		if (*iter == some_val)
			iv.insert(iter, 2 * some_val);
	return 0;
}