خدمة تلخيص النصوص العربية أونلاين،قم بتلخيص نصوصك بضغطة واحدة من خلال هذه الخدمة
Introduction to computer systems
CSC 115
Primitive Data
Types and Variables
How Computing Works?Console.WriteLine("a+b={0} sum={1} equal={2}",
a+b, sum, equal);
41
Decimal Floating-Point Types
? There is a special decimal floating-point
real number type in C#:
? decimal (+-1,0 x 10-28 to +-7,9 x 1028): 128-bits,
precision of 28-29 digits
? Used for financial calculations
? No round-off errors
? Almost no loss of precision
? The default value of decimal type is:
? 0.0M (M is the suffix for decimal numbers)
42
The Boolean Data Type
? The Boolean data type:
? Is declared by the bool keyword
? Has two possible values: true and false
? Is useful in logical expressions
? The default value is false
43
Boolean Values - Example
? Example of boolean variables taking values of
true or false:
int a = 1;
int b = 2;
bool greaterAB = (a > b);
Console.WriteLine(greaterAB); // False
bool equalA1 = (a == 1);
Console.WriteLine(equalA1); // True
44
The Character Data Type
? The character data type:
? Represents symbolic information
? Is declared by the char keyword
? Gives each symbol a corresponding integer code
? Has a '\0' default value
? Takes 16 bits of memory (from U+0000 to
U+FFFF)
45
Characters and Codes
? The example below shows that every symbol
has an its unique Unicode code:
char symbol = 'a';
Console.WriteLine("The code of '{0}' is: {1}",
symbol, (int) symbol);
symbol = 'b';
Console.WriteLine("The code of '{0}' is: {1}",
symbol, (int) symbol);
symbol = 'A';
Console.WriteLine("The code of '{0}' is: {1}",
symbol, (int) symbol);
46
The String Data Type
?class_"A"? point9 ? Declaring Variables
? When declaring a variable we:
? Specify its type
? Specify its name (called identifier)
? May give it an initial value
? The syntax is the following:
? Example:
<data_type>
Introduction to computer systems
CSC 115
Primitive Data
Types and Variables
How Computing Works?
Computers are machines that process data
Data is stored in the computer memory in
variables
Variables have data type, name and value
Example of variable definition and assignment
in C#
int count = 5;
Data type
Variable name
Variable value
3
What Is a Data Type?
A data type:
Is a domain of values of similar characteristics
Defines the type of information stored in the
computer memory (in a variable)
Examples:
Positive integers: 1, 2, 3, …
Alphabetical characters: a, b, c, …
4
Data Type Characteristics
A data type has:
Name (C# keyword ---- int, double)
Size (how much memory is used)
Default value
Example:
Integer numbers in C#
Name: int
Size: 32 bits (4 bytes)
Default value: zero
5
Overview of Common Type System (CTS
CTS supports both value and reference types
Reference Type
Type
Value Type
Comparing Value and
Reference Types
◼ Value types:
◼ Directly contain
their data
◼ Each has its own
copy of data
◼ Operations on one
cannot affect
another
◼ Reference types:
◼ Store references to their
data (known as objects)
◼ Two reference variables
can reference same
object
◼ Operations on one can
affect another
Comparing Built-in and UserDefined Value Types
◼ Examples of
built-in value
types:
◼ Int
◼ double
◼ Examples of user-defined
value types:
◼ enum
◼ struct
User-Defined
Value Types
Built-in Type
Data Types
9
Type Size Description Range
bool 1 byte Store truth value true / false
char 1 byte Store one character character code 0 – 255
byte 1 byte Store positive integer 0 – 255
short 2 byte Store integer -32,768 -- 32,767
int 4 byte Store integer -2.1 x 109
-- 2.1 x 109
long 8 byte Store integer -9.2 x 1018
-- 9.2 x 1018
double 16 byte Store real number ± 5.0x10-324
-- ±
1.7x10308
string N/A Store sequence of
characters
N/A
What are Integer Types?
Integer types:
Represent whole numbers
May be signed or unsigned
Have range of values, depending on the size of
memory used
The default value of integer types is:
0 – for integer types, except
0L – for the long type
10
Integer Types
Integer types are:
sbyte (-128 to 127): signed 8-bit
byte (0 to 255): unsigned 8-bit
short (-32,768 to 32,767): signed 16-bit
ushort (0 to 65,535): unsigned 16-bit
int (-2,147,483,648 to 2,147,483,647): signed
32-bit
uint (0 to 4,294,967,295): unsigned 32-bit
11
Integer Types (2)
More integer types:
long (-9,223,372,036,854,775,808 to
9,223,372,036,854,775,807): signed 64-bit
ulong (0 to 18,446,744,073,709,551,615):
unsigned 64-bit
12
Measuring Time – Example
Depending on the unit of measure we may use
different data types:
byte centuries = 20; // Usually a small number
ushort years = 2000;
uint days = 730480;
ulong hours = 17531520; // May be a very big number
Console.WriteLine("centuries is years, or days, or
hours.", centuries, years, days, hours);
13
Console.ReadLine()
Gets a line of characters
Returns a string value
Returns null if the end of the input is reached
Console.Write("Please enter your first name: ");
string firstName = Console.ReadLine();
Console.Write("Please enter your last name: ");
string lastName = Console.ReadLine();
Console.WriteLine("Hello, ",firstName, lastName);
14
Reading Numeral Types
Numeral types can not be read directly from the
console
To read a numeral type do the following:
تلخيص النصوص العربية والإنجليزية اليا باستخدام الخوارزميات الإحصائية وترتيب وأهمية الجمل في النص
يمكنك تحميل ناتج التلخيص بأكثر من صيغة متوفرة مثل PDF أو ملفات Word أو حتي نصوص عادية
يمكنك مشاركة رابط التلخيص بسهولة حيث يحتفظ الموقع بالتلخيص لإمكانية الإطلاع عليه في أي وقت ومن أي جهاز ماعدا الملخصات الخاصة
نعمل علي العديد من الإضافات والمميزات لتسهيل عملية التلخيص وتحسينها
In this presentation, I will focus on main points: First, I will provide a definition of the concep...
في خسائر فادحة للذرة، والمحاصيل السكرية، والأعلاف النجيلية، والكينوا. لمواجهة هذه التحديات بفعالية،...
أدى الإنترنت والتطور الرقمي إلى إحداث تحول جذري في أساليب التواصل وتبادل المعلومات بين الأفراد. فنحن...
تم اختيار الصور بعناية لتعكس نمط الحياة الصحي والطابع الحيوي للموقع، حيث تُستخدم كعنصر بصري داعم يعز...
تُعد عدالة الأحداث من أهم القضايا التي تشغل الأنظمة القانونية والاجتماعية في مختلف دول العالم، نظرًا...
كان تحالف ديلوس في البداية قوة دفاعية ناجحة، لكنه تحول مع الوقت إلى أداة للسيطرة الأثينية، مما أدى إ...
--- ### **التعريف:** عوائق التعلم التنظيمي هي **عوائق إدراكية، أو ثقافية، أو هيكلية، أو شخصية** تم...
أولا شعر الحزب الزبيري بدا يتنصيب عبد الله بن الزبير نفسه خليفة على الحجاز، واستمر تسع سنوات، وانته...
ث- الصراع: يعتبر من المفاهيم الأقرب لمفهوم الأزمة، حيث أن العديد من الأزمات تنبع من صراع بين طرفين...
تعرض مواطن يدعى عادل مقلي لاعتداء عنيف من قبل عناصر مسلحة تابعة لمليشيا الحوثي أمام زوجته، في محافظة...
زيادة الحوافز والدعم المالي للأسر الحاضنة لتشجيع المشاركة. تحسين تدريب ومراقبة العاملين الاجتماعيين...
Because learning changes everything.® Chapter 13 Mutations and Genetic Testing Essentials of Biology...