I don't know if these are 'good' examples, they are a bit contrived, but at least an illustration of possibilities:
1 2 3 4 5 6
int n = 0;
cout << "Please enter an integer: \n";
cin >> n;
cout << "The number is " << (n % 2 ? "odd" : "even") << endl;
When declaring a variable and assigning an initial value. Using if/else you may have to first declare the variable and then assign a different value afterwards:
The fundamental difference is that the if-else statement is not an expression, the conditional operator can be used as part of an expression. There are programming situations where only an expression would do; for instance to intialise a constant object.
1 2 3 4 5 6 7
struct A
{
// an expression is required for direct initialisation of name
A( constchar* cstr ) : name( cstr && *cstr ? cstr : "anonymous" ) {}
const std::string name;
};