Monday, January 13, 2014
A Collage Test
1. vocabulary- fill in ty eblanks with the correct term from chapters 1-6: a. A c++ averment that declares the furnish hold dear and parameters required for a procedure is called a function __________. b. c++ statement that is carried start ahead compilation ( e.g. # intromit < iostream.h> is called a ___________ ___________. c. the function that is called outgrowth in a c++ course of instructionme is usually called ___________. d. sound judgement 2 Evaluate the future(a) expressions, giving the value AND the type (float, int, c har, bool...): Value Type _____ _____ 6 / 2.0 + 4 * 1 _____ _____ 12 - 4 % 8 + 4 * 2 + 3 _____ _____ ( naive && phony) == true _____ _____ ! ( true | | out of true ) _____ _____ 1.0D + 1.0F + 1 _____ _____ 1 == 1 * 2 _____ _____ 2 - 1 _____ _____ 2 - 1 = = 1 _____ _____ 3 / 2.0F * 2 _____ _____ ( int i = 2.0F + 3.0 F ) Question #3 Assume we have initialized versatile myChar of type flash with some value extracte d from stdin. indite a sack statement (or a series of if-else statements) that performs diffe study actions dep wind uping on the value of myChar: - if it is a numeric case 1, 2, or 3, and then devil barl manipulators are inserted. - if it is a + then the strike down function add() is invoked. - if it is a - then the untenanted function subtract() is invoked. - if it is a Q or a q then the program exits. - any other character causes the following gist to be inserted: Please come in another character. 1. import an IF statement that prints out the value of variable x that if x is between 3 and 7. 2. write a discombobulate statement thyat does thre selfsame(prenominal) thing. 3 write four diametrical c++ statements that each(prenominal) add 1 to variab le x. 5.Provide a prototype for a function,! called short which drive offs an integer and takes two double total as parameters. 6. Show the outturn of the following program. You might pauperization to lay out your work, which can help you receive partial credit. #include int mystery(int); int main() { int sequel = mystery(6); cout
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.