summaryrefslogtreecommitdiff
path: root/6p56.cpp
blob: 12e91e9e7176e78d152242b0f671313436025caa (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <vector>

/*
 *
 * 6.54
 *
 *
 */

int summing(int a, int b) {

	return a + b;
}

int subtracting(int a, int b) {

	return a - b;
}

int multiplying(int a, int b) {

	return a * b;
}

int dividing(int a, int b) {

	return a / b;
}

int main () {

	int (*fpfp)(int, int) = summing;
	int (*fpfp1)(int, int) = subtracting;
	int (*fpfp2)(int, int) = multiplying;
	int (*fpfp3)(int, int) = dividing;
	std::vector<int(*)(int, int)> funcvec = {fpfp, fpfp1, fpfp2, fpfp3};
	for(auto a : funcvec) {
		std::cout << a(10, 10) << std::endl;
	}
	
	return 0;
}