Skip to content

Instantly share code, notes, and snippets.

@raarce
Created August 21, 2012 00:56
Show Gist options
  • Save raarce/3410099 to your computer and use it in GitHub Desktop.
Save raarce/3410099 to your computer and use it in GitHub Desktop.
Conditional Assignment
// Ejemplo cout usando conditional assignment
#include <iostream>
using namespace std;
int main (void) {
int a = 35;
cout << "El numero es " << ((a % 2) ? "impar." : "par.") << endl;
cout << "El numero es ";
if (a % 2)
cout << "impar.";
else
cout << "par.";
cout << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment