Name: ____________________________________________________ Alpha:
_____________ Section: ________
Describe help received: _________________________________________________________________
See the bottom for how to submit your work.
Due: Before 0800 on next class day
Note: each expression should be taken as independent. I.e. if one expression modifies some variable values, those modifications do not carry over to the next expression.
// Function prototypes - each function what the name says it does
int abs(int j); // returns "absolute value" of j. defined in library cstdlib
double round(double x); // returns x rounded to nearest integer. defined in library cmath
string to_string(int val); // returns string representing val. defined in library string
// Variable definitions
int k = 3;
double x = -3.8;
string s = "The number of cookies I need: ";
| expression | type | value |
k + abs(x) | ||
x + abs(k) | ||
round(x) + k | ||
abs(x) = k | ||
k = round(x) | ||
s + to_string(k + 5) | ||
to_string(int(round(x))) | ||
(3 + 10)/round(x - 1) | ||
to_string(1) > to_string(2) | ||
to_string(1) + 3 |