Short Answer 46. Use a logical OR to write a more concise equivalent of the foll
ID: 3918248 • Letter: S
Question
Short Answer
46. Use a logical OR to write a more concise equivalent of the following code:
if(saleAmount >= 300) cout << "Delivery available" << endl; else if(areaCode == LOCAL_CODE) cout << "Delivery available" << endl;
47. Write a program that projects sales goals for a salesperson for the next several years. The user should be prompted for a first year’s merchandise sales amount and a number of years to project the goals. For the first year, the salesperson’s goal is the current sales amount. After that, sales are projected to grow at a rate of 8 percent per year. You should use a do-while loop.
48. What happens if a subscript exceeds the size of an array?
49. How is the null character represented in C++?
50. What are some errors typically made by beginning programmers when they declare, call, and write functions?
Explanation / Answer
48)Answer:
In C, nothing happens, because array values cannot be assigned.
If you mean initialization rather than assignment, then that’s a constraint violation, meaning that any conforming compiler is required to diagnose it. (The diagnostic may be a non-fatal compile-time warning.) An example of this is:
If you mean indirectly assigning an array using memcpy or memmove, attempting to copy past the end of any object has undefined behavior. The compiler is not required to diagnose the error, and the run-time behavior can range from doing nothing to crashing your program to yielding arbitrary incorrect results. It’s up to the programmer to avoid doing that
49)Answer:
In C++, the null character is represented as ''
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.