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
Get step-by-step solutions from verified subject matter experts
