🗊Презентация OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs

Нажмите для полного просмотра!
OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №1OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №2OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №3OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №4OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №5OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №6OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №7OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №8OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №9OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №10OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №11OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №12OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №13OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №14OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №15OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №16OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №17OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №18OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs, слайд №19

Вы можете ознакомиться и скачать презентацию на тему OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs. Доклад-сообщение содержит 19 слайдов. Презентации для любого класса можно скачать бесплатно. Если материал и наш сайт презентаций Mypresentation Вам понравились – поделитесь им с друзьями с помощью социальных кнопок и добавьте в закладки в своем браузере.

Слайды и текст этой презентации


Слайд 1





Course Object Oriented Programming
Lecture 2
OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs.
Описание слайда:
Course Object Oriented Programming Lecture 2 OOP with C#. Introduction C#. Data Types. Variables, expressions, statements. C# decision and iteration constructs.

Слайд 2





C# programming language
C# is a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented(class-based), and component-oriented programming disciplines. 
The core syntax of C# language is similar to that of other C-style languages such as C, C++ and Java. In particular:
Semicolons are used to denote the end of a statement.
Curly brackets are used to group statements. Statements are commonly grouped into methods (functions), methods into classes, and classes into namespaces.
Variables are assigned using an equals sign, but compared using two consecutive equals signs.
Square brackets are used with arrays, both to declare them and to get a value at a given index in one of them.
Описание слайда:
C# programming language C# is a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented(class-based), and component-oriented programming disciplines. The core syntax of C# language is similar to that of other C-style languages such as C, C++ and Java. In particular: Semicolons are used to denote the end of a statement. Curly brackets are used to group statements. Statements are commonly grouped into methods (functions), methods into classes, and classes into namespaces. Variables are assigned using an equals sign, but compared using two consecutive equals signs. Square brackets are used with arrays, both to declare them and to get a value at a given index in one of them.

Слайд 3





Data Types
Data is the fundamental currency of the computer. All computer processing deals with analysis, manipulation and processing of data. Data is entered, stored and retrieved from computers. It is not surprising then, to learn that data is also fundamental to the C# language.
Описание слайда:
Data Types Data is the fundamental currency of the computer. All computer processing deals with analysis, manipulation and processing of data. Data is entered, stored and retrieved from computers. It is not surprising then, to learn that data is also fundamental to the C# language.

Слайд 4





Data Types supported by C#
C# is a strongly typed language, that is, every object or entity you create in a program must have definite type. This allows the compiler to know how big it is (i.e. how much storage is required in memory) and what it can do (i.e. and thereby make sure that the programmer is not misusing it). There are thirteen basic data types in C#, note that 1 byte equals 8 bits and each bit can take one of two values (i.e. 0 or 1).
Описание слайда:
Data Types supported by C# C# is a strongly typed language, that is, every object or entity you create in a program must have definite type. This allows the compiler to know how big it is (i.e. how much storage is required in memory) and what it can do (i.e. and thereby make sure that the programmer is not misusing it). There are thirteen basic data types in C#, note that 1 byte equals 8 bits and each bit can take one of two values (i.e. 0 or 1).

Слайд 5





System Data Types
Описание слайда:
System Data Types

Слайд 6





Variables
The memory locations used to store a program’s data are referred to as variables because as the program executes the values stored tend to change.
Each variable has three aspects of interest, its:
1. type.
2. value.
3. memory address.
The data type of a variable informs us of what type of data and what range of values can be stored in the variable and the memory address tells us where in memory the variable is located.
Описание слайда:
Variables The memory locations used to store a program’s data are referred to as variables because as the program executes the values stored tend to change. Each variable has three aspects of interest, its: 1. type. 2. value. 3. memory address. The data type of a variable informs us of what type of data and what range of values can be stored in the variable and the memory address tells us where in memory the variable is located.

Слайд 7





Declaration of Variables
Syntax: <type> <name>;
Example
int i;
char a, b, ch;
All statements in C# are terminated with a semi-colon.
Описание слайда:
Declaration of Variables Syntax: <type> <name>; Example int i; char a, b, ch; All statements in C# are terminated with a semi-colon.

Слайд 8





Naming of Variables
The names of variables and functions in C# are commonly called identifiers. There are a few rules to keep in mind when naming variables:
1. The first character must be a letter or an underscore.
2. An identifier can consist of letters, numbers and underscores only.
3. Reserved words (int, char, double, …) cannot be used as variable names.
In addition, please note carefully that C# is case sensitive. For example, the identifiers Rate, rate and RATE are all considered to be different by the C# compiler.
Описание слайда:
Naming of Variables The names of variables and functions in C# are commonly called identifiers. There are a few rules to keep in mind when naming variables: 1. The first character must be a letter or an underscore. 2. An identifier can consist of letters, numbers and underscores only. 3. Reserved words (int, char, double, …) cannot be used as variable names. In addition, please note carefully that C# is case sensitive. For example, the identifiers Rate, rate and RATE are all considered to be different by the C# compiler.

Слайд 9





Initialize during variable declaration
Syntax: type var_name = constant;
Example
int i = 20; //i declared and given the value 20
char ch = ‘a’//ch declared and initialised with value .a.
int i = 2, j = 4, k, l = 5; //i, j and l initialised, k not initialised
Declare first then assign
Example
int i, j, k; //declare
i = 2; //assign
j = 3;
k = 5;
Описание слайда:
Initialize during variable declaration Syntax: type var_name = constant; Example int i = 20; //i declared and given the value 20 char ch = ‘a’//ch declared and initialised with value .a. int i = 2, j = 4, k, l = 5; //i, j and l initialised, k not initialised Declare first then assign Example int i, j, k; //declare i = 2; //assign j = 3; k = 5;

Слайд 10





Escape sequences and their meaning.
Описание слайда:
Escape sequences and their meaning.

Слайд 11





Console Input/Output (I/O)
Output
Syntax: Console.WriteLine(<control_string>,<optional_other_arguments);
For example:
Console.WriteLine("Hello World!");
Описание слайда:
Console Input/Output (I/O) Output Syntax: Console.WriteLine(<control_string>,<optional_other_arguments); 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 the value {0}", c);
Console.WriteLine("{0} + {1} = {2}", a, b, c);
Here the symbols {0}, {1} etc. are placeholders where the values of the optional arguments are substituted.
Описание слайда:
Console Input/Output (I/O) int a = 2, b = 3, c = 0; c=a+b; Console.WriteLine("c has the value {0}", c); Console.WriteLine("{0} + {1} = {2}", a, b, c); Here the symbols {0}, {1} etc. are placeholders where the values of the optional arguments are substituted.

Слайд 13





Console Input/Output (I/O)
Input
Syntax: string Console.ReadLine();
The string before the method means that whatever the user types on the keyboard is returned from the method call and presented as a string. 
It is up to the programmer to retrieve that data. An example is:
string input = "";
int data = 0;
Console.WriteLine("Please enter an integer value: ");
Console.ReadLine(); //user input is stored in the string input.
data = Convert.ToInt32(input);
Console.WriteLine("You entered {0}", data);
Описание слайда:
Console Input/Output (I/O) Input Syntax: string Console.ReadLine(); The string before the method means that whatever the user types on the keyboard is returned from the method call and presented as a string. It is up to the programmer to retrieve that data. An example is: string input = ""; int data = 0; Console.WriteLine("Please enter an integer value: "); Console.ReadLine(); //user input is stored in the string input. data = Convert.ToInt32(input); Console.WriteLine("You entered {0}", data);

Слайд 14





Operators
A strong feature of C# is a very rich set of built in operators including arithmetic, relational, logical and bitwise operators. 
 Assignment =
Syntax: <lhs> = <rhs>;
where lhs means left hand side and rhs means right hand side. 
Example
int i, j, k;
i = 20; // value 20 assigned to variable i
i = (j = 25); /* in C#, expressions in parentheses are always evaluated
first, so j is assigned the value 25 and the result of this assignment (i.e.
25) is assigned to i */
i = j = k = 10;
Описание слайда:
Operators A strong feature of C# is a very rich set of built in operators including arithmetic, relational, logical and bitwise operators. Assignment = Syntax: <lhs> = <rhs>; where lhs means left hand side and rhs means right hand side. Example int i, j, k; i = 20; // value 20 assigned to variable i i = (j = 25); /* in C#, expressions in parentheses are always evaluated first, so j is assigned the value 25 and the result of this assignment (i.e. 25) is assigned to i */ i = j = k = 10;

Слайд 15





Arithmetic Operators
Arithmetic Operators (+, -, *, /, %)
+ addition
- subtraction
* multiplication
/ division
% modulus
+ and - have unary and binary forms, i.e. unary operators take only one operand, whereas binary operators require two operands.
Example
x = -y; // unary subtraction operator
p = +x * y; // unary addition operator
x = a + b; // binary addition operator
y = x - a; // binary subtraction operator
Описание слайда:
Arithmetic Operators Arithmetic Operators (+, -, *, /, %) + addition - subtraction * multiplication / division % modulus + and - have unary and binary forms, i.e. unary operators take only one operand, whereas binary operators require two operands. Example x = -y; // unary subtraction operator p = +x * y; // unary addition operator x = a + b; // binary addition operator y = x - a; // binary subtraction operator

Слайд 16





Increment and Decrement operators (++, - -)
Increment (++) and decrement (- -) are unary operators which cause the value of the
variable they act upon to be incremented or decremented by 1 respectively. These
operators are shorthand for a very common programming task.
Example
x++; //is equivalent to x = x + 1;
++ and - - may be used in prefix or postfix positions, each with a different meaning. In prefix usage the value of the expression is the value after incrementing or decrementing. In postfix usage the value of the expression is the value before incrementing or decrementing.
Example
int i, j = 2;
i = ++j; // both i and j have the value 3
i = j++; // now i = 3 and j = 4
Описание слайда:
Increment and Decrement operators (++, - -) Increment (++) and decrement (- -) are unary operators which cause the value of the variable they act upon to be incremented or decremented by 1 respectively. These operators are shorthand for a very common programming task. Example x++; //is equivalent to x = x + 1; ++ and - - may be used in prefix or postfix positions, each with a different meaning. In prefix usage the value of the expression is the value after incrementing or decrementing. In postfix usage the value of the expression is the value before incrementing or decrementing. Example int i, j = 2; i = ++j; // both i and j have the value 3 i = j++; // now i = 3 and j = 4

Слайд 17





Special Assignment Operators 
(+=, -=, *=, /=, %=, &=)
Example
x += i + j; // this is the same as x = x + (i + j);
These shorthand operators improve the speed of execution as they require the expression and variable to be evaluated once rather than twice.
Описание слайда:
Special Assignment Operators (+=, -=, *=, /=, %=, &=) Example x += i + j; // this is the same as x = x + (i + j); These shorthand operators improve the speed of execution as they require the expression and variable to be evaluated once rather than twice.

Слайд 18





Relational Operators in C
Описание слайда:
Relational Operators in C

Слайд 19





Statements
Expression Statements
x = 1;//simple statement
Console.WriteLine(.Hello World!.);//also statement
x = 2 + (3 * 5) – 23;//complex statement
Compound Statements or Blocks
{
statement
statement
statement
}
Описание слайда:
Statements Expression Statements x = 1;//simple statement Console.WriteLine(.Hello World!.);//also statement x = 2 + (3 * 5) – 23;//complex statement Compound Statements or Blocks { statement statement statement }



Похожие презентации
Mypresentation.ru
Загрузить презентацию