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 upload a file with your answers to the assignment page for this studio in Canvas.
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.
To do that, please first ssh
into
shell.cec.wustl.edu
using your WUSTL Key id and password
and then run the command qlogin -q all.q
which will let
you log into a dedicated Linux host.
Then, run the command module add gcc-8.3.0
to add
gcc 8.3.0 to your environment, and please also add that line to
to the .bashrc
file in your home directory so that
the next time you log in it'll be there too (if you run a different
shell than bash, please edit the configuration file for it instead).
As the answer to this exercise, show the output from
running the command which g++
on one of the Linux Lab
machines, and make sure it gives the right version.
wrapper_facade
).
In that directory, edit a new C++ source code file (which should be named
something like wrapper_facade.cpp
) and in it
write a main function whose signature looks like the standard (i.e.,
portable between Linux and Windows) shell (on Windows, terminal window)
program main function
entry point for C++: int main (int, char * [])
.
Please also use the #define
precompiler
directive to define a manifest constant whose value is 0, and have the main
function simply return that constant to indicate successful completion of the
program.
Make sure the code compiles using g++
with the -Wall
(to generate all possible compiler warnings) and -std=c++11
(to enforce the C++11 standard) and -pthread
(to give access to the pthreads library) compiler switches, and that you can run the program.
As the answer to this exercise, please give the full path to the directory
in which the executable program was created (and was run).
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.
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.