C++ examples for Operator:Conditional Operator
What does the following program print: nested while loop and tenary operator
#include <iostream> using namespace std; int main() // w w w . j av a2 s . c om { int row = 10; // initialize row int column; // declare column while ( row >= 1 ) // loop until row < 1 { column = 1; // set column to 1 as iteration begins while ( column <= 10 ) // loop 10 times { cout << ( row % 2 ? "<" : ">" ); // output ++column; // increment column } --row; // decrement row cout << endl; // begin new output line } }