What is the value of i after the following loop

Assignment Help C/C++ Programming
Reference no: EM131103655

Reference list of functions/syntax:

cout <<
cin >>
getline(cin, ...) static_cast<type> (...) 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. 

Reference no: EM131103655

Questions Cloud

How much will your firms total revenues : You are the manager of a firm that receives revenues of $20,000 per year from product X and $80,000 per year from product Y. The own price elasticity of demand for product X is -3, and the cross-price elasticity of demand between product Y and X is -..
Competition might reduce discrimination in the long run : Males under the age of 25 must pay far higher auto insurance premiums than females in this age group. How does this fact relate to statistical discrimination? Statistical discrimination implies that discrimination can persist indefinitely, while the ..
Which food is the most likely vehicle of infection : Using the data in the above line listing, complete the table below. Which food is the most likely vehicle of infection? What type of transmission is this (person-to-person, indirect vehicle-borne, airborne, indirect vector-borne, direct droplet sprea..
Discuss your overall fat intake and what types of fat : How did your intakes compare to the ULs (diet and any supplements combined)? Discuss. how did your intakes compare to fiber and water recommendations? Discuss. discuss your overall fat intake and what types of fat predominate in your diet. how do you..
What is the value of i after the following loop : Determine the truth of the following statement: (5 > 4) && ( (2 > 6) || !(0 > 1) ). What is the value of i after the following loop? int i = 5; while( (i % 3) != 0) { i++ ;}
What is the difference between gdp and gnp : What is the difference between GDP & GNP?
Domestic investment remained the same : if a country were to save more, but its domestic investment remained the same, then which of the following would rise
Motivations were behind increase in federal funds target : What economic circumstances and motivations led to the end of quantitative easing? Be specific. What specific motivations were behind the increase in the federal funds target?
What is the required reserve ratio : What is the required reserve ratio? if the fed increases the reserve requirement from your answer to part a to 10 percent, explain verbally and show numerically what will happen to:

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Pixels down the right of the window

The blue and red values of the pixels across the top of the window are all the same, where the blue is at its maximum value while red is at its minimum value. The green values of the pixels down the right of the window are all the same, where gree..

  The imperial system of measurements

The Imperial system of measurements uses feet and inches for length, where 1 foot is equal to 12 inches. Write a class named Imperial that will represent distance measurements in feet and inches. Your class should include the following.

  Write a recursive function to draw the pattern

write a program that prompts the user to enter the number of lines in the pattern and uses the recursive function to generate the pattern. For example, specifying 4 as the number of lines generates the above pattern.

  What will be the contents of the list after the function

The following c function takes a singly linked list of integers as a parameter and rearranges the elements of the list the function is called with the list containing the integers 1,2,3,4,5,6,7 in the given order what will be the contents of the list..

  C# programming in microsoft visual studio to complete

Please use C# programming in Microsoft Visual Studio to complete this assignment.  You are to write a program that will prompt the user for the following information and then calculate and display the monthly payment.  Amount borrowed

  Prefetching is a technique that leverages predictable

Prefetching is a technique that leverages predictable address patterns to speculatively bring in additional cache blocks when a particular cache block is accessed. One example of prefetching is a stream buffer that prefetches sequentially adjacent..

  Create two classes dm and db which store the value of

Create two classes DM and DB which store the value of distances. DM stores distances in meters and centimeters and DB in feet and inches. Write a program that can read values for the class objects and add one object of DM with another object of DB.

  Find the occupation and the score of each player

We saw in class how to represent a binary search tree in Prolog. Write a predicate lca (K1, K2, T) which allows one to find the smallest common ancestor of K1 and K2 in the tree T. The predicate lca shall print the subtree T such that the root is ..

  Program to compute gross wages for employee using array

Write program which uses the following arrays: payRate: array of seven floats to hold each employee's hourly pay rate. wages: array of seven floats to hold each employee's gross wages.

  Exponent and significant of a floating point

Write a program that requires the number of bits for the exponent and significant of a Floating Point representation; then requires two decimal real numbers and an operation either sum, subtraction or multiplication.

  Write a c program that asks for and reads in two integers

Write a C program that asks for and reads in two integers and then reports if one is a multiple of the other.

  Convert infix to postfix and also calculate the result

I have to convert infix to postfix and also calculate the result. We have been given test data via a text file.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd