What does the following program print: while loop and tenary operator - C++ Operator

C++ examples for Operator:Conditional Operator

Description

What does the following program print: while loop and tenary operator

Demo Code

#include <iostream> 
using namespace std; 

int main() /*from  w  ww  .  j a  v  a  2 s  . co  m*/
{ 
   int count = 1; // initialize count 

   while ( count <= 10 ) // loop 10 times 
   { 
    
       cout << ( count % 2 ? "****" : "++++++++" ) << endl; 
       ++count; // increment count 
   }
}

Result


Related Tutorials