preview

Home Work 1.2.6

Satisfactory Essays

Home Work -1 2.9) Write a single statement or line that accomplishes each of the following a) Print the message “Enter two numbers”. Answer: std::cout<< “enter two numbers”; b) Assign the product of variables b and c to variable a Answer: int a=b*c; c) State that a program performs a payroll calculation (i.e., use text that helps to document a program) Answer: // program performs a payroll calculation (or) /*program performs a payroll calculation*/ d) Input three integer values from the keyboard into integer variables a, b and c. Answer: std::cin>>a>>b>>c; 2.11) Fill in the blanks a) What arithmetic operations are on the same level of precedence as multiplication?__________ …show more content…

Reason: C++ applies the operators in arithmetic expression in precise order determined by these rules of Operator precedence. b) When parentheses are nested, which set of parentheses is evaluated first in an arithmetic expression? Answer: Inner most parentheses Reason: Parentheses are used to specify the order of evaluation. Expressions within the parentheses are evaluated first. If parentheses are nested, the inner most parentheses is evaluated first. c) A location in the computer’s memory that may contain different values at various times throughout the Execution of a program is called a variable. 2.12) Answer x=2,y=3 a) cout<<<< “x=”; Answer : x= d) cout<< “x=”<<<< “=”<>x>>y; Answer : nothing h) //cout<< “x+y=” <<< “\n”; Answer :

Get Access