Software Design Using C++A Practice Lab on Using the Visual C++ 6.0 DebuggerThe purpose of this lab is to acquaint you with workspaces and projects in Visual Studio 6.0 as well as to try out the debugger. Starting OutStart your PC. When you have successfully logged in, start up Visual C++. Create a WorkspaceCreate a new workspace on your M drive, perhaps named using the name of the course. (Skip this if you already have an appropriate workspace.) Create a ProjectCreate a new project within this workspace. Name your new project reverse and make its type Win32 Console Application. Be sure that you tell it to add this project to your current workspace. Finally, select an empty project. Create a Source FileCreate a new C++ source file, named reverse.cpp, and be sure that the "Add to project" box is checked. Copy Existing CodeWe will insert code into the reverse.cpp file from the Web. The code to insert is in the file bad.cpp. Follow the link just shown. In your browser, use Edit, Select All to highlight all of the code. Then use Edit, Copy. Finally go to Visual C++ and click on the empty reverse.cpp file in the editor. Do Edit, Paste. Here is a picture of what you should see. Then use File, Save to save the file. Compile the ProgramUse Build, Rebuild all to try to compile the program. If you get a syntax error, double click on the error message to find the location in the code where the problem was detected. Fix the syntax errors and rebuild. Run and Debug the ProgramOnce the program compiles without errors, run the program. The output will be incorrect. Use the debugger to step through the program line by line to find the problem. (Remember to use Step Into if you want to go inside of a function. Use Step Over if you do not want to go inside of a function when stepping through a line that has a function call. Use Step Out if you need to get out of a function that you have gotten into.) Watch the values of the variables in order to find the problem(s) with the code. Once you locate the logic error(s) in the program, fix them. (Check with the instructor to see if your fix is a good one. Some fixes are good and others are not that great.) Run the program to be sure that the output is now correct. Save Your WorkBe sure that you have saved your corrected reverse.cpp file. If you have time you can also add the missing documentation for the program. Check Your SolutionYou can check your solution by comparing it with the file better.cpp, a working version of the bad.cpp program. Finish UpBe sure to exit from Visual C++ and to properly shut down your computer when you are finished. (Use Start, Shutdown, OK under Windows 2000.) Related Items |