#include #include /* Ovo je C-ovski komentar */ // ovo je C++ komentar using namespace std; void swap(int a, int b) { int tmp = a; a = b; b = tmp; } void swap1(int *a, int *b) { int tmp = *a; *a = *b; *b = tmp; } void swap2(int &a, int &b) { int tmp = a; a = b; b = tmp; } inline int kvadrat(int x) { return x * x; } inline double kvadrat(double x) { return x * x; } int main() { int x(1), y = 3; const int d = 10; bool t = true; int i; cout << "Hello, world" << endl; cout << "Unesi x: "; cin >> x; cout << "Unesi y: "; cin >> y; cout << "t = " << t << endl; cout << "x = " << x << endl; cout << "y = " << y << endl; swap(x, y); cout << "x = " << x << endl; cout << "y = " << y << endl; swap1(&x, &y); cout << "x = " << x << endl; cout << "y = " << y << endl; swap2(x, y); cout << "x = " << x << endl; cout << "y = " << y << endl; cout << "x^2 = " << kvadrat(x) << endl; cout << "x = " << x << endl; cout << "d^2 = " << kvadrat(d) << endl; for (i = 0; i < 10; i++) cout << i << endl; cout << kvadrat(25) << endl; cout << kvadrat(25.5) << endl; printf("%g\n", kvadrat(25.5)); int *p; p = new int[10]; for (i = 0; i < 10; i++) { p[i] = i * i; cout << p[i] << endl; } delete [] p; return 0; }