1#include <iostream>
2
3// macro definition
4#define LIMIT 5
5
6int main()
7{
8 for (int i = 0; i < LIMIT; i++) {
9 std::cout << i << "\n";
10 }
11
12 return 0;
13}
1#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
2#define ar array
3#define ll long long
4#define pb push_back
1// The #define preprocessor directive creates symbolic constants
2#include <iostream>
3using namespace std;
4
5#define CONSTANT 2.71828
6
7int main () {
8 cout << "Declared constant: " << CONSTANT << endl;
9
10 return 0;
11}
1// #define is a macro that lets you use an alias name to
2// make code more readable. During C++'s preproccessing stage, your macro
3// will be replaced with the suitable code needed for proper compiling.
4
5#include <iostream>
6// used to define constants, types, functions and more....
7
8#define SIZE 5
9#define MacroInt int
10#define getmax(a,b) ((a)>(b)?(a):(b))
11
12int main(){
13 MacroInt myIntAsMacro = 7;
14 std::cout<< getmax(SIZE, myIntAsMacro); // will return 7
15}
16