Содержание
- 2. C# programming language C# is a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic,
- 3. Data Types Data is the fundamental currency of the computer. All computer processing deals with analysis,
- 4. Data Types supported by C# C# is a strongly typed language, that is, every object or
- 5. System Data Types
- 6. Variables The memory locations used to store a program’s data are referred to as variables because
- 7. Declaration of Variables Syntax: ; Example int i; char a, b, ch; All statements in C#
- 8. Naming of Variables The names of variables and functions in C# are commonly called identifiers. There
- 9. Initialize during variable declaration Syntax: type var_name = constant; Example int i = 20; //i declared
- 10. Escape sequences and their meaning.
- 11. Console Input/Output (I/O) Output Syntax: Console.WriteLine( , For example: Console.WriteLine("Hello World!");
- 12. Console Input/Output (I/O) int a = 2, b = 3, c = 0; c=a+b; Console.WriteLine("c has
- 13. Console Input/Output (I/O) Input Syntax: string Console.ReadLine(); The string before the method means that whatever the
- 14. Operators A strong feature of C# is a very rich set of built in operators including
- 15. Arithmetic Operators Arithmetic Operators (+, -, *, /, %) + addition - subtraction * multiplication /
- 16. Increment and Decrement operators (++, - -) Increment (++) and decrement (- -) are unary operators
- 17. Special Assignment Operators (+=, -=, *=, /=, %=, &=) Example x += i + j; //
- 18. Statements Expression Statements x = 1;//simple statement Console.WriteLine(.Hello World!.);//also statement x = 2 + (3 *
- 19. Decision Statements If statement
- 20. Example int numerator, denominator; Console.WriteLine(“Enter two integer values for the numerator and denominator”); numerator = Convert.ToInt32(Console.ReadLine());
- 21. The statement body can include more than one statement but make sure they are group into
- 22. Nested if Statement Nested if statements occur when one if statement is nested within another if
- 23. if - else - if operator If a program requires a choice from one of many
- 25. Conditional Operator ?: There is a special shorthand syntax that gives the same result as if
- 26. Example max = x >= y ? x : y; which is the equivalent of if
- 27. Switch Statement This statement is similar to the if-else-if ladder but is clearer, easier to code
- 28. Example double num1, num2, result; char op; Console.WriteLine(“Enter number operator number \n”); num1 = Convert.ToInt32(Console.ReadLine()); op
- 29. Iterative Statements For statement While statement Do while statement Break statement Continue statement
- 30. The while Looping Constructs The while looping construct is useful should you wish to execute a
- 31. The do/while Looping Constructs Closely related to the while loop is the do/while statement. Like a
- 32. Decision Constructs C# defines two simple constructs to alter the flow of your program, based on
- 33. C# Relational and Equality Operators Logical operators
- 34. The if/else statement static void IfElseExample() { // This is illegal, given that Length returns an
- 36. Скачать презентацию