From 9924ee83206bf2645cc1d5576e2e25202f1e0894 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Tue, 29 Mar 2022 20:02:24 +0300 Subject: Create macrosExample.cpp --- Sem. 06/Macros/macrosExample.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Sem. 06/Macros/macrosExample.cpp diff --git a/Sem. 06/Macros/macrosExample.cpp b/Sem. 06/Macros/macrosExample.cpp new file mode 100644 index 0000000..fe08c2c --- /dev/null +++ b/Sem. 06/Macros/macrosExample.cpp @@ -0,0 +1,31 @@ +#include +#include +#include + +//example for a macro +#define MAX(a,b) (a>b ? a : b) + +using namespace std; + + +int max(int a, int b) +{ + return a > b ? a : b; +} +int main() +{ + clock_t begin = clock(); + + for (int i = 0; i < 10000000; i++) + max(4, 10); + + clock_t end = clock(); + cout << "10000000 calls of max function: " << double(end - begin)<