Created
August 21, 2012 00:56
-
-
Save raarce/3410099 to your computer and use it in GitHub Desktop.
Conditional Assignment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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