Question
Create a library. The library should contain two functions, Hello() and World(). Calling the Hello() function should print out the string Hello; calling the World()
Create a library. The library should contain two functions, Hello() and World(). Calling the Hello() function should print out the string Hello; calling the World() function should print out the string World. The library should use a ag (implemented using a static global variable) that keeps track of which string was last printed. A call to the Hello() function should print out Hello only if World was the last string printed, and vice versa. The flag should be updated at the end of each function call. Each function should return 1 if the string was printed, 0 otherwise. Write a simple program that uses the library and tests for the correct working of the functions.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started