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

/*
 *
 * 4.31
 *
 * There is no difference, because what is returned is discarded.
 * ++ix and --cnt is technically better because we return nothing
 * but there isnt a difference because both programs do the same thing.
 */

int main () {
	
	std::vector<int> ivec(10);
	std::vector<int>::size_type cnt = ivec.size();
	for(std::vector<int>::size_type ix = 0 ; ix != ivec.size() ; ix++, cnt--) {
		ivec[ix] = cnt;
	}

	for(auto a : ivec) {
		std::cout << a << std::endl;
	}
	
	return 0;
}