Download presentation
Presentation is loading. Please wait.
1
Guidelines for working with Microsoft Visual Studio 6
2
Create a new Project
3
Select Project Type
5
Create New File
6
Write the Code
7
Stage 2: Compile
8
Create Executable File
9
Stage 3: Execute
10
Execution Window
11
Inserting a breakpoint Press right mouse button and select “Insert Breakpoint”
12
Start Debugging
13
Stopping at a Breakpoint The “Watch” window will show the values of the variables
14
Stepping Over “Step over” and check the values in the “Watch” window
15
Run to Cursor “Run to cursor” will run till the current cursor position
16
Checking a value of a variable
17
Choose “Add Watch” to a variable to the “Watch” window
18
Factorial #include int main(void) { int i,n, fact=1; printf("Enter a number: "); scanf("%d", &n); for (i =1; i<=n; i++){ fact*=i; } printf ("\nThe functorial is: %d\n", fact); return 0; }
19
Stepping through a Loop
20
Errors Syntax errors – caught by compiler Run-time errors - seen during program execution. Reasons for run-time errors: –Infinite loops –Division by zero –Many more … Important Termination Commands: –Unix: -C –MS-DOS: -C or -break
21
Compilation Errors Example
22
Run Time Error Example Don’t try this at home!!!
23
Infinite Loop Don’t try this at home!!! Use C to terminate the execution
24
Code and Compilation Examples
25
Printing Numbers #include int main(void) { int i; for(i=0; i<100; i++){ printf("%d\n", i); } return 0; }
26
Printing Numbers #include int main(void){ int i,j; for(i=0; i<20; i++){ for(j=0;j<20;j++){ printf("%d ", i); } printf("\n"); } return 0; }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.