I often use cout for debugging purpose in many different places in my code, and then I get frustrated and comment all of them manually.
Is there a way
To supress output, you can disconnect the underlying buffer from cout.
#include
using namespace std;
int main(){
// get underlying buffer
streambuf* orig_buf = cout.rdbuf();
// set null
cout.rdbuf(NULL);
cout << "this will not be displayed." << endl;
// restore buffer
cout.rdbuf(orig_buf);
cout << "this will be dispalyed." << endl;
return 0;
}