think:
 

A ?  " 1 " : " 0 "

如果A執行完的結果是true or 1reture A ?  " 1 " : " 0 "
的前項

如果A執行完的結果是false or 0reture A ?  " 1 " : " 0 "
的後項

題目:  輸出結果是什麼?


程式碼:

// What does this program print?
#include <iostream>
using std::cout;
using std::endl;

int main()
{
   int i = 1; 

   while ( i <= 5 ) 
   {  
 
      // output line of text
       cout << ( i % 2 ? "~~ I am true!!!~~" : " ~~I am false!!!~~" ) << endl;
      ++i; 
   } 

   return 0; 

 

顯示結果:

arrow
arrow
    全站熱搜

    布拉怡 發表在 痞客邦 留言(1) 人氣()