b) Rewrite this code segment using a for loop and a switch case statement instead of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
b) Rewrite this code segment using a for loop and a switch case statement instead of the while loop and if statements. Note: The functions are NOT one from our demo lab code. (5 pts) unsigned char trial = 0, tP_history [100]; while (trial < 100) { } tP = alphaTouchPad (); // returns letter A-E for touch pad tP_history [trial] = tP; if (tP == 'A') led_on(0); else if (tP == 'B') led_on (1); else if (tP == 'C') led_on(2); else if (tP == 'D') led_on (3); else if (tP == 'E') led_on(4); trial++; b) Rewrite this code segment using a for loop and a switch case statement instead of the while loop and if statements. Note: The functions are NOT one from our demo lab code. (5 pts) unsigned char trial = 0, tP_history [100]; while (trial < 100) { } tP = alphaTouchPad (); // returns letter A-E for touch pad tP_history [trial] = tP; if (tP == 'A') led_on(0); else if (tP == 'B') led_on (1); else if (tP == 'C') led_on(2); else if (tP == 'D') led_on (3); else if (tP == 'E') led_on(4); trial++;
Expert Answer:
Related Book For
Computer Architecture A Quantitative Approach
ISBN: 978-0123704900
4th edition
Authors: John L. Hennessy, David A. Patterson
Posted Date:
Students also viewed these computer network questions
-
Construct a scatter plot for each data set. Then calculate r and r2 for each data set. Interpret their values. a. b. c. d. x2 1 0 2 |-2125 x -2 -1 0 2 1 22 3 3 3 4
-
5) On the graphs below show the difference between a change in price and a change in demand. Fully label graphs for full marks! (2+2 marks) Change in price Change in demand X 6) A change in the price...
-
Deuterium ( ) is an attractive fuel for fusion reactions because it is abundant in the oceans, where about 0.015% of the hydrogen atoms in the water (H 2 O) are deuterium atoms. (a) How many...
-
What determines profitability for exhibitors? Consider revenue components, expenses, and the controllability of these by managers. What is the trend in profitability? What explains this?
-
Bluestar Airlines has physical assets valued at \($12,500,000,\) and according to industry experts, the net present value of its future earnings amounts to \($40.00\) per share. Assuming there are...
-
Draw an energy diagram for just the basket in Figure 9.10. Figure 9.10 Different choices of system yield different energy diagrams. (a) System basket + Earth (b) System person + rope + basket + Earth...
-
Estimating a cost function The controller of the Ijiri Company wants you to estimate a cost function from the following two observations in a general ledger account called Maintenance: Required1....
-
1. In connection with the circuit drawn below, the value of current flowing through 2 kQ resistor is 10-4A. 2. 5V 1 www 2. 3. 4. 5. 6. 7. An audio signal Vm = 20 sin 2(1500t) amplitude modulates a...
-
Complete the 2019 federal income tax return for Sarah Hamblin. Be sure to include only required tax forms when completing the tax return. For purposes of this assignment, unless instructed otherwise,...
-
Let D be the interior of the closed contour formed by C = the left half of the unit circle {e/2 03/2} and C2 = the line segment between-i and i. a) Find a Fractional Linear Transofrmation f(z) such...
-
Please explain the behaviour why an investor purchases an insurance policy to lower risk exposure, while trading derivatives at the same time. Is it rational? (8 marks)
-
Are the asymmetric information problems associated with the international firms more severe than those for local (domestic) firms? Explain. Different regulation in terms of tax, accounting standard,...
-
Mike needs to borrow $7,500 for five years. The loan will be repaid in one lump sum at the end of the loan term. What interest rates is best for Mike? Explain why interest rate is best. are you in...
-
A preferred stock offers a rate of return of 6.50 percent and sells for $90.50? What is the annual dividend amount?
-
The loan balance decreases from 100 at time t to 90 at time t+1. The periodic interest rate is 10%. Calculate the periodic payment (or interest and principal payments) between time t and time t+1.
-
Wankana Ltd. is a Canadian controlled private company throughout the taxation year ending December 31, 2019. Other information that is relevant to the Companys 2019 taxation year is as follows. 1....
-
In Problem 8.43, determine the smallest value of for which the rod will not fall out of the pipe. IA -3 in.-
-
If you ever get confused about what a register renamer has to do, go back to the assembly code you're executing, and ask yourself what has to happen for the right result to be obtained. For example,...
-
Assume you are redesigning a hardware prefetcher for the unblocked matrix transposition code above. The simplest type of hardware prefetcher only prefetches sequential cache blocks after a miss. More...
-
You will begin by designing an I/O subsystem that is optimized only for capacity and performance (and not reliability), specifically IOPS. Discuss the RAID level and block size that will deliver the...
-
What will be the amount accumulated by each of the following present investments? a. $3,000 invested for 7 years at 14 percent compounded annually b. $1,600 invested for 17 years at 12% compounded...
-
How much money would have to be deposited today to accumulate a. $10,000 after 6 years if the investment earns 5%/year compounded annually. b. $6,500 after 4 years if the investment earns 8...
-
On August 1, 1958, first-class postage for a 1-ounce envelope was 4. On August 1, 2007, a first-class stamp for the same envelope cost 41. What was the annual compound increase in the cost of...
Study smarter with the SolutionInn App