Introduction to Visual Studio.NET Integrated Information Systems
Guidelines for working with Microsoft Visual Studio.Net.
-
date post
21-Dec-2015 -
Category
Documents
-
view
230 -
download
0
Transcript of Guidelines for working with Microsoft Visual Studio.Net.
Guidelines for working with Microsoft Visual Studio .Net
Create a new Project
Select Project Type
Create a New File
Select File Type
Save the File
Save the File
Add File to Project
Write the Code
Stage 2: Compile
Create Executable File
Stage 3: Execute
Output Window
Inserting a breakpoint
Press right mouse button and select “Insert Breakpoint”
Start Debugging
Stopping at a Breakpoint
Place the mouse on the variable of interest and check its value
Debug Windows
Choose the window that will show the variables of interest
Stepping Over
“Step over” and check the values in the “Watch” window
Run to Cursor
“Run to cursor” will run till the current cursor position
Checking a value of a variable
Checking a value of a variable
Choose “Add Watch” to a variable to the “Watch” window
Factorial
#include <stdio.h>
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;
}
Stepping through a Loop
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: <Cntrl>-C – MS-DOS: <Cntrl>-C or <Cntrl>-break
Code and Compilation Examples
Printing Numbers
#include <stdio.h>
int main(void) {
int i;
for(i=0; i<100; i++){
printf("%d\n", i);
}
return 0;
}
Printing Numbers#include <stdio.h>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;
}
Compilation Errors Example
Run Time Error Example
Don’t try this at home!!!
Infinite Loop
Don’t try this at home!!!
Use <Cntrl> C to terminate the execution