Guidelines for working with Microsoft Visual Studio.Net.

30
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.

Page 1: Guidelines for working with Microsoft Visual Studio.Net.

Guidelines for working with Microsoft Visual Studio .Net

Page 2: Guidelines for working with Microsoft Visual Studio.Net.

Create a new Project

Page 3: Guidelines for working with Microsoft Visual Studio.Net.

Select Project Type

Page 4: Guidelines for working with Microsoft Visual Studio.Net.

Create a New File

Page 5: Guidelines for working with Microsoft Visual Studio.Net.

Select File Type

Page 6: Guidelines for working with Microsoft Visual Studio.Net.

Save the File

Page 7: Guidelines for working with Microsoft Visual Studio.Net.

Save the File

Page 8: Guidelines for working with Microsoft Visual Studio.Net.

Add File to Project

Page 9: Guidelines for working with Microsoft Visual Studio.Net.

Write the Code

Page 10: Guidelines for working with Microsoft Visual Studio.Net.

Stage 2: Compile

Page 11: Guidelines for working with Microsoft Visual Studio.Net.

Create Executable File

Page 12: Guidelines for working with Microsoft Visual Studio.Net.

Stage 3: Execute

Page 13: Guidelines for working with Microsoft Visual Studio.Net.

Output Window

Page 14: Guidelines for working with Microsoft Visual Studio.Net.

Inserting a breakpoint

Press right mouse button and select “Insert Breakpoint”

Page 15: Guidelines for working with Microsoft Visual Studio.Net.

Start Debugging

Page 16: Guidelines for working with Microsoft Visual Studio.Net.

Stopping at a Breakpoint

Place the mouse on the variable of interest and check its value

Page 17: Guidelines for working with Microsoft Visual Studio.Net.

Debug Windows

Choose the window that will show the variables of interest

Page 18: Guidelines for working with Microsoft Visual Studio.Net.

Stepping Over

“Step over” and check the values in the “Watch” window

Page 19: Guidelines for working with Microsoft Visual Studio.Net.

Run to Cursor

“Run to cursor” will run till the current cursor position

Page 20: Guidelines for working with Microsoft Visual Studio.Net.

Checking a value of a variable

Page 21: Guidelines for working with Microsoft Visual Studio.Net.

Checking a value of a variable

Choose “Add Watch” to a variable to the “Watch” window

Page 22: Guidelines for working with Microsoft Visual Studio.Net.

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;

}

Page 23: Guidelines for working with Microsoft Visual Studio.Net.

Stepping through a Loop

Page 24: Guidelines for working with Microsoft Visual Studio.Net.

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

Page 25: Guidelines for working with Microsoft Visual Studio.Net.

Code and Compilation Examples

Page 26: Guidelines for working with Microsoft Visual Studio.Net.

Printing Numbers

#include <stdio.h>

int main(void) {

int i;

for(i=0; i<100; i++){

printf("%d\n", i);

}

return 0;

}

Page 27: Guidelines for working with Microsoft Visual Studio.Net.

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;

}

Page 28: Guidelines for working with Microsoft Visual Studio.Net.

Compilation Errors Example

Page 29: Guidelines for working with Microsoft Visual Studio.Net.

Run Time Error Example

Don’t try this at home!!!

Page 30: Guidelines for working with Microsoft Visual Studio.Net.

Infinite Loop

Don’t try this at home!!!

Use <Cntrl> C to terminate the execution