Hello codeforces!
This is the debugging header i use in C++ wich i got from tourist and modified it a bit
And this is my main code:
The code is not complete but it can show how you define the debugger
How to use:
you type debug(value[1],value[2],...,value[n])
you can send as many values as you want and the debugger will print them
Examples:
int a = 5;
bool b = 1;
char c = 'c';
double d = 1.52;
vector<int>v = {1,2,3};
vector<vector<int>>vv = { {1,2,3},{5,6} };
map<char, int>mp;
mp['a'] = 1;
mp['h'] = 4;
debug(a, b, c, d);
debug(v, vv, mp);
Output:
[a, b, c, d, e] = [5, true, 'c', 1.52]
[v, vv, mp] = [{1,2,3}, {{1,2,3},{5,6}}, {{'a',1},{'h',4}}]
Working data types:
- int
- char
- double
- float
- long long
- unsinged
- string
- vector
- set
- map
- pair
- multiset
and any data type you can iterate by for(auto it : name)
Data types that does not work
- stack
- queue
- deque
- priority_queue
and any data type you can't iterate by for(auto it : name)
How to set it:
- Create a header file called "Debug.h"
- Copy that file to your includes folder
if you use visual studio you can open your includes folder by holdingctrl
button and hovering over your main include wich is usually bits/stdc++.h > right click on the header file when it opens > show in explorer - Paste the Debug.h file into the folder that just opened
OR
- Create a header file called "Debug.h"
- Leave the header file in any place
- Change the include from
#include <Debug.h>
to#include "<Header file location>"
Sorry for any typing mistakes it took me very long time to write