[an error occurred while processing this directive]
In order to create a project in Microsoft Visual Studio, you must first have a version which includes C++. Select File→New→Project which brings up the New Project modal dialog. Create a new C++ project and it is easiest to begin with a general empty project as is shown in Figure 1.
Notice: If you are working in any Engineering Computing laboratories, you must make absolutely sure that in the Project types: pane, the project type Visual C++ is selected and not the default (which happens to be General) and in the Templates: pane, the Visual Studio installed template Empty Project is selected.
Figure 1. Creating a new project in Microsoft Visual Studio.
Next, we must copy all the source files into the directory (on the author's machine) C:\Users\dwharder\Documents\Visual Studio 2008\Projects\Project_1a\Project_1a\. Note that the header, source, and resource directory is the project name repeated.
Figure 2. Copying the relevant files to the source directory.
The next step is to add the appropriate files to the appropriate groupings. We will start with adding header files (.h files which contain the class declarations and definitions). Right click on the HeaderFile branch and select Add→Existing Item... as is shown in Figure 3.
Figure 3. Add existing files to the project header files.
This brings up the Add Existing Item - Project_1a modal dialog. Select all the .h files as shown in Figure 4.
Figure 4. Selecting the .h header files to add to Project_1a.
Do the same with SourceFiles but add only one .cpp file, most likely Single_list_int_driver.cpp. Your project will not build if you add two or more .cpp files with int main() functions. Double-click on Single_list.h to begin editing the file. Your setup should appear as is shown in Figure 5; however, a larger window may be more appropriate for editing.
Figure 5. Editing the Single_list.h class.
Finally, you are able to build your solution: select Build→Build Solution or select F7. The output from the build appears in the lower window.
You will notice that the default project compiles. This was deliberately designed this way to assist you with your coding. You now have a choice: either add code to the class one member function at a time, testing it at each step to determine whether or not it still compiles and possibly testing the function, or attempt to write absolutely everything first and only build once everything is complete. The latter choice is the more common choice of beginners and procrastinators.
The default directory for the executable is the Projects\Project_1a\Debug\ directory where you will find the Project_1a.exe file. You can now open a command console (cmd) and cd into this directory and attempt to run your code with the provided input. This is shown in Figure 6.
Figure 6. Running the executable with the provided input.
As is obvious, some work must be done to ensure that the output matches the file sli.out.
Two drivers are provided with each class to be built. Thus, it is essential that once you have the output matching for sli.out, you remove Single_list_int_driver.cpp from the project and replace it with Single_list_double_driver.cpp and test this with the input file sld.in.
The need for this second set of tests is that students will, on occasion, replace the templated type Type with the primitive type int. Thus, the class will only work correctly for Single_list<int> and no other format.