void Tennis() { int i; float x; x = 1.0/7.0; for (i=0;i<20; i++) { x = x + 1.0/7.0 if (x == 2.0) std::cout << x << ” Matchn”; (a) The author of the above function expected it to print Match once. It compiled with no errors. However, when run, it printed nothing at all. Explain why. (b) Write down a better version of the same if test that would work as intended. Note: If you need a function but can’t remember the exact name for it, it is acceptable to invent your own name and add a note explaining what the function does. Show transcribed image text void Tennis() { int i; float x; x = 1.0/7.0; for (i=0;i
Expert Answer
Answer to void Tennis() { int i; float x; x = 1.0/7.0; for (i=0;i…