#include using namespace std; int sum(int a, int b) { //formal parameters int rslt = a + b; return rslt; } int max(int i, int j) { if (i >= j) return i; return j; } void intro() { int i = 5, j = 7, k = 1; int r = sum(i, j); //actual parameters, arguments cout << r << " " << sum(j, k) << endl; cout << sum(k, sum(j, j)); } void increment1(int k) { k++; cout << k << endl; } void increment2(int& k) { k++; cout << k << endl; } void passByValueOrReference() { int a = 0; increment1(a); cout << a << endl; a=0; increment2(a); cout << a << endl; } int preIncrement(int& i) { i=i+1; return i; } int postIncrement(int& i) { int l=i; i=i+1; return l; } double power(double basi, int ekthetis) { if (ekthetis==0) return 1; double rVal=1; for (int i=0; i=1; i--) x=x*i; return x; } void prt2Powers() { for (int ekt=0; ekt<=16; ekt++) cout << "2 stin " << ekt << " equals to " << power(2,ekt) << endl; } int main(int argc, char** argv) { intro(); passByValueOrReference(); cout << power(2,4) << endl; prt2Powers(); for (int i=0; i<5; i++) cout << i << " " << paragontiko(i) << endl; return 0; }