#define, #ifdef, #endif to remove cout code

I'm trying to figure out how to use: #define, #ifdef, and #endif with my code (with no luck).
During debug, i want the couts in there to appear, but then i want a quick and easy way to remove/comment out any of the cout arguments there. For example, how would i incorporate it into this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

#define // <----- what in here?
#ifdef // <------ something that looks at cout?
#endif // <------- goes here, or below main body of code?

int main(){

float x = 10;

cout << "x = " << x;

return 0;

}





Usually it's like
1
2
3
#ifdef _DEBUG
cout << "x = " << x;
#endif 
but what if i had multiple entries of couts all over?
1
2
3
4
5
6
7
8
9
10
11
12
#ifdef _DEBUG
#define DEBUGPRINT(x)  cout << x;
#else
#define DEBUGPRINT(x)
#endif

//...

int main()
{
  DEBUGPRINT("x = " << x);
}
Topic archived. No new replies allowed.