Please send questions to
st10@humboldt.edu .
Macintosh-194:131lect08-1 smtuttle$ expr_play
----------------------------------------------
Welcome to the 03-03-10 version of expr_play!
----------------------------------------------
Are there any already-created C++ functions (in the current
working directory) which you would like to be able to use
within C++ expressions?
(type y if so, n if not)
your answer: n
Enter a C++ expression, and type enter
(or type q to quit):
3 + 5
value of 3 + 5:
8
Enter next C++ expression and type enter
(or type q to quit):
4 / 5
value of 4 / 5:
0
Enter next C++ expression and type enter
(or type q to quit):
4.0 / 5.0
value of 4.0 / 5.0:
0.8
Enter next C++ expression and type enter
(or type q to quit):
4.0 / 5
value of 4.0 / 5:
0.8
Enter next C++ expression and type enter
(or type q to quit):
10 / 3
value of 10 / 3:
3
Enter next C++ expression and type enter
(or type q to quit):
-10 / 3
value of -10 / 3:
-3
Enter next C++ expression and type enter
(or type q to quit):
5 / 2
value of 5 / 2:
2
Enter next C++ expression and type enter
(or type q to quit):
5 % 2
value of 5 % 2:
1
Enter next C++ expression and type enter
(or type q to quit):
PI
try_expr9.cpp: In function ‘int main()’:
try_expr9.cpp:9: error: ‘PI’ was not declared in this scope
*****************************************************
Are you sure that PI is truly a C++ arithmetic
expression (with no variables)?
Chances are good that it is not; the above are C++
compiler messages. Save them and show them to
your prof if you have questions.
*****************************************************
Enter next C++ expression and type enter
(or type q to quit):
1.0 / 3
value of 1.0 / 3:
0.333333
Enter next C++ expression and type enter
(or type q to quit):
3 + 5 * 8
value of 3 + 5 * 8:
43
Enter next C++ expression and type enter
(or type q to quit):
(3 + 5) * 8
value of (3 + 5) * 8:
64
Enter next C++ expression and type enter
(or type q to quit):
(((3) + (5)) * 8)
value of (((3) + (5)) * 8):
64
Enter next C++ expression and type enter
(or type q to quit):
(3 +)
try_expr14.cpp: In function ‘int main()’:
try_expr14.cpp:9: error: expected primary-expression before ‘)’ token
*****************************************************
Are you sure that (3 +) is truly a C++ arithmetic
expression (with no variables)?
Chances are good that it is not; the above are C++
compiler messages. Save them and show them to
your prof if you have questions.
*****************************************************
Enter next C++ expression and type enter
(or type q to quit):
^Z
[2]+ Stopped expr_play
Macintosh-194:131lect08-1 smtuttle$ ls
131lect08-1-play try_expr2
131lect08-1-projected.txt try_expr2.cpp
131lect08-1-projected.txt~ try_expr3
131lect08-1.odt try_expr3.cpp
131lect08-1.pdf try_expr4
try_expr1 try_expr4.cpp
try_expr1.cpp try_expr5
try_expr10 try_expr5.cpp
try_expr10.cpp try_expr6
try_expr11 try_expr6.cpp
try_expr11.cpp try_expr7
try_expr12 try_expr7.cpp
try_expr12.cpp try_expr8
try_expr13 try_expr8.cpp
try_expr13.cpp try_expr9.cpp
try_expr14.cpp
Macintosh-194:131lect08-1 smtuttle$ fg
expr_play
3 - 7
value of 3 - 7:
-4
Enter next C++ expression and type enter
(or type q to quit):
true
value of true:
true
Enter next C++ expression and type enter
(or type q to quit):
3 < 5
value of 3 < 5:
true
Enter next C++ expression and type enter
(or type q to quit):
3 > 5
value of 3 > 5:
false
Enter next C++ expression and type enter
(or type q to quit):
3 <= 5
value of 3 <= 5:
true
Enter next C++ expression and type enter
(or type q to quit):
4 >= 4
value of 4 >= 4:
true
Enter next C++ expression and type enter
(or type q to quit):
3 + 5 == 8
value of 3 + 5 == 8:
true
Enter next C++ expression and type enter
(or type q to quit):
(3 + 5) == 8
value of (3 + 5) == 8:
true
Enter next C++ expression and type enter
(or type q to quit):
3 != 4
value of 3 != 4:
true
Enter next C++ expression and type enter
(or type q to quit):
3 = 5
try_expr24.cpp: In function ‘int main()’:
try_expr24.cpp:9: error: lvalue required as left operand of assignment
*****************************************************
Are you sure that 3 = 5 is truly a C++ arithmetic
expression (with no variables)?
Chances are good that it is not; the above are C++
compiler messages. Save them and show them to
your prof if you have questions.
*****************************************************
Enter next C++ expression and type enter
(or type q to quit):
'a' == 'a'
value of 'a' == 'a':
true
Enter next C++ expression and type enter
(or type q to quit):
"a" == "a"
try_expr26.cpp: In function ‘int main()’:
try_expr26.cpp:9: error: invalid operands of types ‘const char [2]’ and ‘const char [3]’ to binary ‘operator<<’
*****************************************************
Are you sure that "a" == "a" is truly a C++ arithmetic
expression (with no variables)?
Chances are good that it is not; the above are C++
compiler messages. Save them and show them to
your prof if you have questions.
*****************************************************
Enter next C++ expression and type enter
(or type q to quit):
true and false
value of true and false:
false
Enter next C++ expression and type enter
(or type q to quit):
(3 < 5) && (5 < 8)
value of (3 < 5) && (5 < 8):
true
Enter next C++ expression and type enter
(or type q to quit):
(3 < 5) and (5 < 8)
value of (3 < 5) and (5 < 8):
true
Enter next C++ expression and type enter
(or type q to quit):
not true
value of not true:
false
Enter next C++ expression and type enter
(or type q to quit):
!true
value of !true:
false
Enter next C++ expression and type enter
(or type q to quit):
true || false
value of true || false:
true
Enter next C++ expression and type enter
(or type q to quit):
true or false
value of true or false:
true
Enter next C++ expression and type enter
(or type q to quit):
3 not = 5
try_expr34.cpp: In function ‘int main()’:
try_expr34.cpp:9: error: expected `)' before ‘!’ token
*****************************************************
Are you sure that 3 not = 5 is truly a C++ arithmetic
expression (with no variables)?
Chances are good that it is not; the above are C++
compiler messages. Save them and show them to
your prof if you have questions.
*****************************************************
Enter next C++ expression and type enter
(or type q to quit):
not(3 == 5)
value of not(3 == 5):
true
Enter next C++ expression and type enter
(or type q to quit):
q
Quitting expr_play ... goodbye.
Macintosh-194:131lect08-1 smtuttle$