4ProgramStructureIII

# Ument operand t hand side arg only a righ d value

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: / Dept of CS / Helena Wong http://www.cs.cityu.edu.hk/~helena 4. Program Structure III - 14 Data Types Decision Making: Logical Operators To perform Boolean algebra. Logical AND : && Logical OR : || Logical NOT : ! -side Boolean and Right-hand and-side Combine Left-h nds) to give Boolean result ra arguments (ope ). ument (operand t-hand-side arg Only a righ d value. Give its reverse va r a ll_p a s s e d = true ; if ( (e ng lis h _m a rk < 4 6 ) || (c h ine s e _m a rk < 4 6 ) || (m a th s _m a rk < 4 6 ) ) a ll_p a s s e d = fa ls e ; if (a ll_p a s s e d ) a le rt( 'C o ng ra d u la tio ns ! Y o u p a s s a ll s u b je c ts .' ) ; e ls e a le rt('S o rry ! Y o u c a nno t p a s s a ll s ub je c ts .') ; (CS1301) Introduction to Computer Programming City Univ of HK / Dept of CS / Helena Wong http://www.cs.cityu.edu.hk/~helena Same as: if ( ! a ll_p a s s e d ) e ls e a le rt('S o rry! Y o u ..') ; a le rt( 'C o ng ra d u la tio ns ! ..' ) ; 4. Program Structure III - 15 Data Types Strings Strings are sequences of letters, digits, punctuation characters,...
View Full Document

## This note was uploaded on 03/10/2012 for the course CS 1301 taught by Professor Dr.wong during the Winter '08 term at City University of Hong Kong.

Ask a homework question - tutors are online