microsoft tech club cairo university "mstc'16 builders and developers " second...

22
Introduction to C # Session #2 Prepared and Presented by Wagdy Mohamed Aya Zakaria

Upload: wagdy-mohamed

Post on 16-Jan-2017

388 views

Category:

Mobile


0 download

TRANSCRIPT

Introduction to C#Session #2

Prepared and Presented by

Wagdy Mohamed Aya Zakaria

Revision

Universal Applications

Data Types

IDE and Compiler

Class, Namespace, System

Ready made functions

Agenda

Operators

Decision making structures

Loops

Arrays

OperatorsArithmetic operators

Relational operators

Logical operators

Assignment operators

Arithmetic operators + Addition - Subtraction * Product / Division % Modulus ++ Increment -- Decrement

Relational operators

Logical operators

&& And

|| OR

! Not

Assignment operatorsMeaning Example Operator

x = 5 x = 5 =

x =x+5 x += 5 =+

x = x-5 x -= 5 =-

x = x*5 x *= 5 =*

x = x/5 x /= 5 =/

Decision Making Structures

If statement

If else statement

If… else if statement

If statementif (condition){Statements will execute if the condition is true.}

Condition CodeTrue

False

End

End

If…. else statementif (condition){Statements will execute if the condition is true}

else{Statements will execute if the condition is false}

Condition CodeTrue

False

Code

Else

End

End

If …else if statementsif (condition1){Executes when condition1 is true}

else if(condition2) {Executes when condition 2 is true}Else{Executes when condition 1 and 2 arefalse}

Condition

Code

True

FalseElse if EndCondition

False

Code

True

End End

Loops

Initialization expression

Conditionalexpression

Update expression

For and while loop

For(int x=0;x<5;x++){ //loop body}

int x=0;While(x<5){ // loop body x ++;}

Do… while loop

int x=0;do{x++; //loop body}while(x<5);

wagdy.mohamed.95

[email protected]

yoya.zakaria

[email protected]

Contacts