CSE 532S Wrapper Facade Studio

Please complete the required studio exercises listed below, along with any of the (optional) enrichment exercises that interest you.

As you work through the exercises, please record your answers in a file, and upon completion please e-mail your answers to the cse532@seas.wustl.edu course e-mail account with Wrapper Facade studio in the subject line.

Please make sure that the name of each person who worked on these exercises is listed in the first answer, and that you number your answers so they are easy for us to match up with the appropriate exercise.


    Required Exercises

  1. As the answer to the first exercise, list the names of the people who worked together on this studio.

  2. Open up Visual Studio 2013, make sure your settings are for C++, and create a new project for this studio (for example named something like wrapper_facade).

    In the main C++ source code file for the project (which should be named something like wrapper_facade.cpp) please modify the main function signature so that it looks like the standard (i.e., portable between Windows and Linux) main function entry point for C++: int main (int, char * []) and make sure the code compiles and that you can run the program from a windows terminal shell (hint: you can run cmd from the main start window to get a terminal shell).

    As the answer to this exercise, please give the full path to the directory where the executable program was created.

  3. Write a function that takes no arguments and prints out a single line message to the standard output stream, and call that function from your program's main function (hint: for this exercise and the ones that follow, please use endl to both end the line and flush the stream). Build and run your program, and as the answer to this exercise please show the output the program produced.

  4. Modify your program's main function so that instead of calling the function directly it creates a separate thread with that function as the thread's entry point, and then joins with that thread (as shown in Williams Section 1.4.1). Build and run your program, and please confirm that the output it produces is the same as it produced for the previous exercise. As the answer to this exercise please show the code itself.

  5. Modify your program's main function so that instead of running the function in a single thread it creates multiple threads each running that same function, and then joins with each of them. Build and run your program, and as the answer to this exercise please show the code and the output your program produced.

    Enrichment Exercise (Optional)

  6. Modify your main function's signature to include variable names (e.g., int main (int argc, char * argv[])) and then repeat any of the previous exercises where the function printed out a message, but this time pass the main function's command line arguments into the function, either directly from the main function or through the thread constructor, depending on the exercise. As the answer(s) to this exercise, please show both the code you wrote and the output the program produced when you compiled and ran it.