Problem Descriptions: The purpose of this assignment is to reinforce the lecture material on variable definition fusage

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Problem Descriptions: The purpose of this assignment is to reinforce the lecture material on variable definition fusage

Post by answerhappygod »

Problem Descriptions The Purpose Of This Assignment Is To Reinforce The Lecture Material On Variable Definition Fusage 1
Problem Descriptions The Purpose Of This Assignment Is To Reinforce The Lecture Material On Variable Definition Fusage 1 (92.83 KiB) Viewed 41 times
Problem Descriptions The Purpose Of This Assignment Is To Reinforce The Lecture Material On Variable Definition Fusage 2
Problem Descriptions The Purpose Of This Assignment Is To Reinforce The Lecture Material On Variable Definition Fusage 2 (43.82 KiB) Viewed 41 times
Problem Descriptions The Purpose Of This Assignment Is To Reinforce The Lecture Material On Variable Definition Fusage 3
Problem Descriptions The Purpose Of This Assignment Is To Reinforce The Lecture Material On Variable Definition Fusage 3 (54.67 KiB) Viewed 41 times
Problem Descriptions: The purpose of this assignment is to reinforce the lecture material on variable definition fusage and DU path. For each of the source code fragments below: 1) Construct a table listing all the line numbers where a variable is defined or used. You must list all the variables in each source code fragment. 2) Construct a DU Path table showing all paths from any definition to usage of every variable. A sample is given below: 1. Int aain() f 2. ehar operator: 3. I double firsthunber, secondilumber; 4. printf("Enten an operator (+,+,+)=") 6. printf("Enter two operands: ") ; 8. If (operator ==∗∗ ) ↑ 9. pelntf ( '  .11f+X.11f=X.11f′′, firstikumber, secondNumber, firsthumber + seconakiaber ) : 10. Yelse if (operator = "." ∗ ) \{ 11. peintf (−Z.11f−Z.11f=x.11fn, firstNunber, secondkumber, firsthunber − seconavumber ); 12. else if (operator =w∗.) \{ 13. printf( " x.11f⋅x.11f=x.11f′′, firstiumber, secondkumber, firsthumber - seconakunber); 14. ) else if (operator =η∗f∗) : 25. peintf (−x.11f/x.11f=8.11f∗, firsthunber, secondumber, firstkumber / seconavunber ); 16. ) else f 17. printf("Errorl aperator is not correct"); 18. ) 19. return 9 ; 2e. 3 DEF-USE Table:
DU Path Table:
Problem 2 1 Hincludeciostreams 2. using namespace std; 3 int main() 1 4 int orange; 5 double orangePrice; 6 int apple; 7 double applePrice; 8 double total; 9 double money. 10. cout ee"How many apple did you buy? * ; 11 cin ≫ >apple; 12. coutce' what's the price of each apple today? 13 cinssapplePrice; 14 cout ce"How many orarge did you buy?"; 15 cin ≫ orange; 16 cout ce "what's the price of each orange today?": 17 cin >s orangePrice; 18 cout < "How much money did you have?"; 19. cin >> money; 20 total = apple * applePrice + orange * orangePrice; 21 If fotal>moneyff 22 cout « "You don't have enough money. " « money; ] 23 elsef 24 cout ee "You should pay:; 25 cout
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply