![Page 1: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/1.jpg)
Our EnvironmentOur Environment
We will exercise on We will exercise on Microsoft Visual C++ v.6Microsoft Visual C++ v.6
because that is what we have in the univ.because that is what we have in the univ. but there are many free compilers, too.but there are many free compilers, too.
![Page 2: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/2.jpg)
Visual C++ (v6)Visual C++ (v6)
![Page 3: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/3.jpg)
Visual C++ (v6)Visual C++ (v6)
New.. Ctrl+N
![Page 4: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/4.jpg)
Visual C++ (v6)Visual C++ (v6)
Choose: “Win32 Console Application”
Project and file directory
project title(name of .exe)
![Page 5: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/5.jpg)
Visual C++ (v6)Visual C++ (v6)
![Page 6: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/6.jpg)
Visual C++ (v6)Visual C++ (v6)
New source file will be included in the project
![Page 7: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/7.jpg)
Visual C++ (v6)Visual C++ (v6)
Choose: “c++ source file”
Give a file name with
extension .c
![Page 8: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/8.jpg)
Visual C++ (v6)Visual C++ (v6)
Write your program here
![Page 9: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/9.jpg)
Visual C++ (v6)Visual C++ (v6)
Compile the C file
![Page 10: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/10.jpg)
Visual C++ (v6)Visual C++ (v6)
Build an executable (.exe)
file.
![Page 11: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/11.jpg)
Visual C++ (v6)Visual C++ (v6)
Run the executable file (.exe). When this menu is selected, even if the compiling was not complete, it
will re-compile.
Error and warning messagswill be here.
![Page 12: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/12.jpg)
Visual C++ (v6)Visual C++ (v6)
Program output and interface at DOS prompt.
![Page 13: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/13.jpg)
Visual C++ (v6)Visual C++ (v6)
Open a previously
created project.
![Page 14: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/14.jpg)
Visual C++ (v6)Visual C++ (v6)
![Page 15: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/15.jpg)
Compiler structureCompiler structure
![Page 16: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/16.jpg)
Program generation Program generation stepssteps
![Page 17: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/17.jpg)
Error investigationError investigation
By double clicking on the error message, you can go to the line
containing the error.
There is a variable which is forgotten to be declared before
used.
![Page 18: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/18.jpg)
DebuggingDebugging
Add an integer variable with
name “a”
![Page 19: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/19.jpg)
Linker errorsLinker errors
A function with name “print” is not defined.
![Page 20: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/20.jpg)
The correct one should be printf
![Page 21: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/21.jpg)
Execution errorExecution error
![Page 22: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/22.jpg)
The correct usage of printf for writing
out numbers
![Page 23: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/23.jpg)
DebuggerDebugger
![Page 24: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/24.jpg)
Until now, you should have encountered Until now, you should have encountered programming mistakes. Use debugger:programming mistakes. Use debugger:
Build->set active configuration-> win32 debug
![Page 25: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/25.jpg)
Insert breakpointInsert breakpointChose line Put break point
Start debugging with “F5” or
Build->Start Debug->Go
![Page 26: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/26.jpg)
Debug screenDebug screen
Functions Stack
Variables watching
Current running
line
Debug toolbar
![Page 27: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/27.jpg)
Run line by line by pressing “F10”
or clicking this button
Trace variable values here
![Page 28: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/28.jpg)
Move mouse over the
variable name, and see the
current values
![Page 29: Our Environment We will exercise on Microsoft Visual C++ v.6 We will exercise on Microsoft Visual C++ v.6 because that is what we have in the univ. because](https://reader035.vdocuments.net/reader035/viewer/2022062719/56649ed25503460f94be1a0a/html5/thumbnails/29.jpg)
To execute and skip to the next
breakpoint, press “F5”