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

  Find the pairs in any given matrix

write a c program which will find the pairs in any given matrix, whose sum of pairs are 10.

  Display a year-by-year depreciation schedule

Create GUI screen interface that accepts input and shows output and resize the GUI screen & the list box to best fit the output displayed

  Write a program that declares three one dimensional

Write a program that declares three one dimensional arrays named miles, gallons, and mpg . Each array should be declared in main( ) and should be capable of holding ten double

  Problem related to c programming

write a Grade Book program for his class to help him compute final grades. Design a program that asks for the student's name and four test grades. You are to display the student's name, four test grades, the average of the four test grades and the..

  Write a program that asks the user to enter two numbers.

Starting Out with C++ Write a program that asks the user to enter two numbers.

  Software and system standards

Describe system and software standards that could be used for the description of control constructs in C, C#, or Java.

  What will be the value of xafter executing the above switch

If x = 3, then what will be the value of xafter executing the above switch statement?

  Take the code you wrote for the ford-fulkerson algorithm

Take the code you wrote for the Ford-Fulkerson algorithm for the maximum flow on a directed graph with capacities, and implement scaling on top of this code. You write a function

  Explain how to convert c program to mips program

Convert the following C program to MIPS program. Assuming that i, j, k, f, are stored in registers $s0, $s1, $s2, $s3 already.

  Function alter with two parms passed by reference

Write a function alter with two parms passed by reference: x and y. alter changes the value of x to x+y and changes the value of y to x*y. Write a main function to read in two integers, print the two integers, call the function alter using the two..

  Write a program that gets an input from the user

Write a program that gets an input from the user and places it in a character array. The program should print the input backwards.

  Write a function called reversit that reverses a string

Write a function called reversit() that reverses a string (an array of char ). Use a for loop that swaps the first and last characters, then the second and next to lastcharacters and so on. The string should be passed to reversit() as an argument. wr..

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