Determine the truth of the following statement 5 gt 4


Reference list of functions/syntax:

cout <<
cin >>
getline(cin, ...) static_cast (...) some_string.length() some_string.substr(m) some_string.substr(m,n) some_string[i]
left, right
setw(n) set ll('[character]') setprecision(n)
xed if (...) { ... }
else if (...) { ... } else (...) { ... } while (...) { ... }

1. One-Liners (1 mark each) Place answer in the box. Generally no partial credit.

(a)  Determine the truth of the following statement: (5 > 4) && ( (2 > 6) || !(0 > 1) )

(b)  What is the value of i after the following loop? int i = 5; while( (i % 3) != 0) { i++ ;}

2. Short Answer

Consider the class declaration below for a class that stores numbers and returns the largest/smallest in the collection.class MaxMin

{public: //  Create a new MaxMin object  MaxMin();
//  Add a double to MaxMin collection void include(double new_num);
//  Return the largest number in collection double get_max() const;
//  Return the smallest number in collection double get_min() const;
};
private:
// Stuff you don't need to worry about };

Write a few lines of code that will:

(a)  Create a new MaxMin object called MM.

(b)  Add the value 3.14 to the MM collection.

(c)  After several items have been added, write a few lines that will output "Yes" if the smallest element is less than or equal to -7 and otherwise print "No".

Assume all necessary header less and supporting les are already included, you are in the standard namespace, your code appears somewhere inside the main routine, etc. 

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Determine the truth of the following statement 5 gt 4
Reference No:- TGS01481656

Now Priced at $15 (50% Discount)

Recommended (94%)

Rated (4.6/5)