8 questions. Covers De Morgan rewrites.
Questions 1 to 5 of 8
cpp #include <iostream> #include <string> using namespace std; string check(int n) { if (n < 0) { return "negative"; } if (n > 10) { return "big"; } return "small"; } int main() { cout << check(-3) << " " << check(12) << " " << check(4) << "\n"; }
cpp #include <iostream> using namespace std; int main() { cout << boolalpha; int age = 17; bool has_id = true; cout << !(age >= 18 && has_id) << " " << (age < 18 && !has_id) << "\n"; }
cpp string check_amount(int amount) { if (amount > 0) { return "amount must be positive"; } return "ok"; }
amount <= 0
bool
string
return "ok"
cpp int age = 16; if (!age >= 18) { cout << "refused\n"; }
if
>=
<=
!
age
!age
!(age >= 18)
age < 18
endl
\n
double
!(x < 1.0)
x >= 1.0
<
5 question(s) left on this page.