//============================================================== // Ilustracja dyrektywy preprocesora #define;
// makro; //
// ver data temat autor // 100 2005/10/12 Pierwszy projekt J. Malinowski // 101 2007/11/08 Cleanup JM // 102 2019/12/12 Cleanup JM //============================================================== #include <iostream.h> #include <conio.h> //---// Potrafisz przewidzieć , jakie wyniki da ten program?
// uruchamiaj go używając kolejno poniższych linii // odkomentowujac je, ale tylko jedna na raz;
#define SQUARE(x) x*x // #define SQUARE(x) (x)*(x) // #define SQUARE(x) ((x)*(x)) //============================================================== main() { int iz,ix=2;
cout << "\nwartosci dla x=2:\n";
cout << "\nwartosc dla SQUARE(x): " << SQUARE(ix); cout << "\nwartosc dla SQUARE(x+2): " << SQUARE(ix+2); cout << "\nwartosc dla 100/SQUARE(2): " << 100/SQUARE(2); cout << "\nwartosc dla SQUARE(++x): " << SQUARE(++ix); getch();
return 0; }