Yes, but only if the condition is available at compile time. In your case the value of i is a run time quantity, so you cannot use it with the preprocessor. I think what you really want is an if statement:

Thank you for your answer.
In my example, MYCONDITION is known. But in my code, MYCONDITION is not. It's known only at the time of execution as an argument in the command line.

Then what you need to do is parse the command line and store the relevant arguments in variables and then use those variables to determine what happens in your code.

So perhaps something like this?

#include<iostream>
using namespace std;
#define MAXVAL 10
// program takes one argument and is invoked like this:
// program.exe {value for myCondition 1-10}
// e.g.
// program 2
// This will run the program and will display an extra message on the 2nd iteration of the loop
int main(int argc, char* argv[])
{
int myCondition;
// Check the command line parameters...
// First ensure that there are only two arguments (filename and the value for "myCondition")
if(argc==2)
{
// ok, we have the correct number of arguments,
// so convert the 2nd argument in the array to an int
// and assign it to myCondition.
myCondition = atoi(argv[1]);
// Ensure myCondition is within our bounds
if(myCondition<=MAXVAL && myCondition>0)
{
// now we'll loop 10 times and say hello each time
for(int i=1; i<=MAXVAL; ++i)
{
cout << "Hello #" << i << endl;
if( i==myCondition) // display an extra message or three!
{
cout << "i = " << i << " and myCondition = " << myCondition << endl;
cout << "This block of code only gets called when i == myCondition." << endl;
cout << "Is that what you were aiming for?" << endl << endl;
}
}
return 0; // success!
}
else
{
// value of myCondition is out of bounds
cout << "ERROR: the value of the argument must be 1..10";
return 1; // failed
}
}
// if we got here, then the program was passed the incorrect number of arguments
cout << "ERROR: program takes one argument!";
return 1; // failed
}

Apologies for the extra long lines in the code above...it'll look neater if you copy and paste the above code into a text editor!

Anyway, the above program takes one parameter (an int value between 1 and 10). As long as it gets a valid parameter, it loops 10 times and prints hello. But whenever the value of i in the loop is equal to the value of the parameter, an extra block of messages are displayed.

Attached is a .png of the program running...I've very imaginatively called the program program.exe.

By looking at the .png you can see that it traps errors with the command-line parameters..I've tried running it a few times passing it bad parameter values before finally passing a valid parameter of 6.

Anyway, I hope that is close to the kind of thing that you are trying to achieve.
It's probably not exactly what you're after, but it at least shows you how to deal with command line arguments inside your program.