السلام عليكم
مو عارفه كيف ابدا
بس حصل انو عقلي اتوقف مو عارفه افكر
وموقادره احل الكلام دا كااني اشوف رموز مو قادره افهم

________________
Answer the following exercises
1. Evaluate the following expressions using the relational operators
and the ASCII Collating Sequence (express your answer with true
or false).
Expression Expression Value
’ ’ <’a’
’R’ > ’t’
’+’ > ’*’
’6’ >= ’>’
!(’A’ > ’B’)
!(6 <= 7)
(14 >= 5 ) && (’A’ < ’B’)
(24 >=35) && ( 7 < 9 )
(’A’ <+ ’a’) || ( 7 != 7 )
_____________________________
2. Suppose we have the following declarations:
bool found = true ;
bool flag = false ;
int num = 1 ;
double x = 3.4 ;
double y = 3.4 ;
int a = 5 , b = 8 ;
int n = 20 ;
char ch = ’B’;
Consider the flowing expressions state the answer for each one
(Express your answers with true or false).
Expression Answer
!found
x > 4.0
!( found && ( x >= 0 )
x + y <= 20.5
(’A’<= ch && ch <= ’Z’
( a + 2 <= b ) && !flag
___________________________________________
3. Evaluate the following expressions. Express your answer with tr
or false.
Expression E
(17<4*3+5)|| (8*2 == 4*4)&& !(3 + 3== 6)
(6*3 == 36/2)||(13<3*3+4)&& !(6-2 < 5)
2 % 4 * 5 && 5 % 4 * b
6 * 2 == 4*3
5 % 2 * 4 > 5 || 4 % 2 * 5 < 7
_____________________________________
4. Write relational expressions to express the following conditions
use declaration statements and choose variable names):
a. A person age is equal to 17.
b. A person temperature is greater than 37.5.
c. A person height is less than 6 feet.
d. A person age is 12 and the person is taller than 5 feet.
th st
day of the 1 month.
e. The current day is the 15
f. A person is older than 50 or has been employed at the
company for at least 5 years.
_________________________________________
5. Suppose you have this C++ code what is the out put of it.
int x , y ;
x = 8 ; y = 9 ;
if ( 6 <2*5 )
cout<<”Hello”;
cout<<”There”;
if ( x == y ) cout <<”Good marring” ;
cout<<”Good night”<< endl;
if (x = 9 )
cout<<”It is a bright star”;