Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Lab Session-II CSIT 121 Fall 2000 Visual Studio Introduction Lab-1 Explanation and Demos Debugging Tips How to add new files to your projects How many.

Similar presentations


Presentation on theme: "1 Lab Session-II CSIT 121 Fall 2000 Visual Studio Introduction Lab-1 Explanation and Demos Debugging Tips How to add new files to your projects How many."— Presentation transcript:

1

2 1 Lab Session-II CSIT 121 Fall 2000 Visual Studio Introduction Lab-1 Explanation and Demos Debugging Tips How to add new files to your projects How many files are created for your project? Lab Exercises

3 2 Visual Studio Introduction Visual Studio is a suite of programming tools from Microsoft. C++ is a part of this suite. Launch Visual C++from Start->Programs- >Visual Studio x.x->Microsoft Visual C++ The screen will be divided into three areas The large grey window to the right is the work area

4 3 Visual Studio Introduction The narrower window to the left is the workspace window and the bottom window is the output window You can control the appearance of your screen by right clicking and then selecting or de-selecting various windows We will be developing console projects in our work, starting with single C++ files

5 4 NiMo’s varying rates Example: Niagara Mohawk wants to apply different rates to its customers. If the customer burns more than 1000 units in a month, rate B is applied else rate A is applied. You need to develop a software function that can give the total charges as output given a customer’s consumption.

6 5 NiMo’s varying rates You develop the data model for this problem What is the input to your function? Answer: consumption, A, B What is the output? Answer: charges What formula to be used? Answer (A or B)*consumption

7 6 Top Down Design If you are given a complex problem, you are better off dividing it into sub-problems Target is to let each sub-problem deal with one aspect of the software Thus you can rapidly develop the software to solve complex problems

8 7 NiMo’s varying rates In our example, the program can be divided into three sections: Answer: Input, processing, output Write a code segment to get the rates Write a code segment to process the charges Write a code segment to output the charges

9 8 Lab-1 Assignment Due Sep 5th Finish the NiMo varying rates program and test it with two sample customers. One customer will have rate A applied and the other one will have rate B applied to the monthly bill. Demo due TODAY. No need to submit a printout if the demo is given in the lab today

10 9 Some Aspects of Visual Studio Your project can be set in “Debug” or “Release” states ( Build->Set Active Configuration ) In “Debug” state, you can apply several debugging options. Debug is set by default You can start debugging by invoking the debugger

11 10 Debugging Tips Let us try a few simple steps Open your source file, make a mistake and try to recompile it (demo) The compiler gives an error message Click on the error message The compiler takes you to the line where the error is, press F1 to learn more

12 11 Starting the Debugger Once you have compiled the project, you can start the debugger by first inserting breakpoints A Breakpoint is where the program execution will halt Thus you can see the values of various variables at that point

13 12 Using the Debugger Inserting breakpoints is very convenient way of stopping at suspected problem location and examining the values of variables (Click the “hand” in the corner) Using “GO” causes the debugger to run the program until the next break point (Click on “Build”--> “Start Debug”-->GO)

14 13 Adding New Files to Your Project You can add new files to your project once you have compiled and tested your first file The way to do it is to create a new C++ source file and save it as part of your project If you define a new function in the new file, you must declare it before using it

15 14 How many files? Use Explorer or winfile to check out all the files that Visual C++ creates for your project.exeExecutable program file.objMachine code for every source file.ilkLinker uses this file to avoid re-linking code that was not modified

16 15 How many files?.pchPre-compiled header file.pdbDebugging information.idbAdditional debug information

17 16 Lab Exercises Exercise 3 and 4 p98 of the textbook. Use your car or a friend’s car to assign values to variables declared in Exercise 3 and print these values out followed by owner’s last name and first name. (Check the source code listed on page 74 for hints). Demo is to be given in the next lab session.


Download ppt "1 Lab Session-II CSIT 121 Fall 2000 Visual Studio Introduction Lab-1 Explanation and Demos Debugging Tips How to add new files to your projects How many."

Similar presentations


Ads by Google