For More :
https://www.facebook.com/Computer-Programming-Assignments-826290177441561/
-
https://www.facebook.com/A-Tech-and-Software-Development-1683037138630673/
Structured Languages- Need and Characteristics of OOP, Data Types and Modifiers, Arrays, Classes, Objects, Pointers, References, Difference between Pointers and References, Inheritance, Constructors, Destructors, and Polymorphism.
Data types, Variables, Expressions & Arithmetic Operators in javaJaved Rashid
What are the Primitive data types in Java?
What is a variable?
Rules for naming a variable.
How to declare a variable.
Assignment Statement
Assignment & Initialization of a variable
Strings in Expressions
What is a Expression
How expressions are evaluated
Arithmetic Operators
Order of Precedence & Associativity
For More :
https://www.facebook.com/Computer-Programming-Assignments-826290177441561/
-
https://www.facebook.com/A-Tech-and-Software-Development-1683037138630673/
Structured Languages- Need and Characteristics of OOP, Data Types and Modifiers, Arrays, Classes, Objects, Pointers, References, Difference between Pointers and References, Inheritance, Constructors, Destructors, and Polymorphism.
Data types, Variables, Expressions & Arithmetic Operators in javaJaved Rashid
What are the Primitive data types in Java?
What is a variable?
Rules for naming a variable.
How to declare a variable.
Assignment Statement
Assignment & Initialization of a variable
Strings in Expressions
What is a Expression
How expressions are evaluated
Arithmetic Operators
Order of Precedence & Associativity
A simple C program to transform input data to output data. (Time-series data)
Purpose: Demonstration of C programming.
Audience: Aspiring C or C++ Developers.
Model: A simple signal processing example (an FIR Filter).
Features: data types, control flow, floating point numbers, program input and output.
Disclaimer: Nothing in this slideshow is novel. This topic has been covered countless times, and can easily be found on Wikipedia, Youtube, etc.
Errors in the program or slides are my own. I used the Eclipse IDE and GNU gcc on Linux
Keywords, identifiers ,datatypes in C++Ankur Pandey
Everything about Keywords, Identifiers,
Datatypes in C++, in this module you gain knowledge about what is Keywords, Identifiers,
Datatypes in C++ (Object oriented programming).
C programming, RTS Tech. Indore
This is a presentation to take your skills to next level. Hope you will like our work to make programming easier for you.
Feel free to contact for the online/offline batches.
As a solution, the BER model uses a two-dimensional matrix to aid the evaluation of complex multi-unit programs, with quadrants to identify over and underperforming units. The BER model was inspired by portfolio management approaches from the Boston Consulting Group and the General Electric Grid, as well as quadrant analysis by Andreasen (1995). However, its core principles are based on the concept of social return on investment, where output is always compared to input. It provides a relative perspective on performance that allows evaluators to account for impact based on the resources invested in an initiative.
A simple C program to transform input data to output data. (Time-series data)
Purpose: Demonstration of C programming.
Audience: Aspiring C or C++ Developers.
Model: A simple signal processing example (an FIR Filter).
Features: data types, control flow, floating point numbers, program input and output.
Disclaimer: Nothing in this slideshow is novel. This topic has been covered countless times, and can easily be found on Wikipedia, Youtube, etc.
Errors in the program or slides are my own. I used the Eclipse IDE and GNU gcc on Linux
Keywords, identifiers ,datatypes in C++Ankur Pandey
Everything about Keywords, Identifiers,
Datatypes in C++, in this module you gain knowledge about what is Keywords, Identifiers,
Datatypes in C++ (Object oriented programming).
C programming, RTS Tech. Indore
This is a presentation to take your skills to next level. Hope you will like our work to make programming easier for you.
Feel free to contact for the online/offline batches.
As a solution, the BER model uses a two-dimensional matrix to aid the evaluation of complex multi-unit programs, with quadrants to identify over and underperforming units. The BER model was inspired by portfolio management approaches from the Boston Consulting Group and the General Electric Grid, as well as quadrant analysis by Andreasen (1995). However, its core principles are based on the concept of social return on investment, where output is always compared to input. It provides a relative perspective on performance that allows evaluators to account for impact based on the resources invested in an initiative.
What is Data Type?
Primitive Types in C#: Integer Types, Floating-Point Types, Decimal Type, Boolean Type, Character Types, Strings, Objects
Value Types and Reference Types
Variables. Using Variables: Declaring, Initializing, Assigning Value, Accessing Value
Literals: The Values of the Variables in the Source Code. Boolean Literals. Integer Literals. Floating-Point Literals, Decimal Literals, String Literals and Escaping Sequences
Exercises: Working with Primitive Types and Variables
03 and 04 .Operators, Expressions, working with the console and conditional s...Intro C# Book
In this chapter we will get acquainted with the operators in Java and the actions they can perform on the different data types. We will explain the priorities of the operators and we will analyze the different types of operators, according to the count of the arguments they can take and the actions they can perform. In the second part we will examine the conversion of data types.
Esoft Metro Campus - Diploma in Information Technology - (Module IX) Programming with C#.NET
(Template - Virtusa Corporate)
Contents:
Introduction to .NET Framework
.NET Framework Platform Architecture
Microsoft Visual Studio
C# Language
C#, VS and .NET Framework Versions
Your First C# Application
Printing Statements
Comments in C#
Common Type System
Value Types and Reference Type
Variables Declaration in C#
Type Conversion
Arithmetic Operators
Assignment Operators
Comparison Operators
Logical Operators
If Statement
If… Else Statement
If… Else if… Else Statement
Nested If Statement
Switch Statement
While Loop
Do While Loop
For Loop
Arrays
Accessing Arrays using foreach Loop
Two Dimensional Arrays
Classes and Objects in C#
Inheritance in C#
Partial Classes
Namespaces
Windows Forms Applications
Using Buttons, Labels and Text Boxes
Displaying Message Boxes
Error Handling with Try… Catch… finally…
Using Radio Buttons
Using Check Boxes
Using List Boxes
Creating Menus
Creating ToolStrips
MDI Forms
Database Application in C#
Creating a Simple Database Application
SQL Insert / Update / Retrieving / Delete
SQL Command Execute Methods
Data Sets
ESOFT Metro Campus - Diploma in Software Engineering - (Module V) Windows Based Application Development in C#
(Template - Virtusa Corporate)
Contents:
Introduction to .NET Framework
.NET Framework Platform Architecture
Microsoft Visual Studio
C# Language
C#, VS and .NET Framework Versions
Your First C# Application
Printing Statements
Comments in C#
Common Type System
Value Types and Reference Type
Variables Declaration in C#
Type Conversion
Arithmetic Operators
Assignment Operators
Comparison Operators
Logical Operators
If Statement
If… Else Statement
If… Else if… Else Statement
Nested If Statement
Switch Statement
While Loop
Do While Loop
For Loop
Arrays
Accessing Arrays using foreach Loop
Two Dimensional Arrays
Classes and Objects in C#
Inheritance in C#
Partial Classes
Namespaces
Windows Forms Applications
Using Buttons, Labels and Text Boxes
Displaying Message Boxes
Error Handling with Try… Catch… finally…
Using Radio Buttons
Using Check Boxes
Using List Boxes
Creating Menus
Creating ToolStrips
MDI Forms
Database Application in C#
Creating a Simple Database Application
SQL Insert / Update / Retrieving / Delete
SQL Command Execute Methods
Data Sets
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
4. How Computing Works?
Computers are machines that process data
Data is stored in the computer memory in
variables
Variables have name, data type and value
Example of variable definition and assignment
in C#
int count = 5;
Data type
Variable name
Variable value
4
5. What Is a DataType?
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, …
Days of week: Monday, Tuesday, …
5
6. DataType Characteristics
A data type has:
Name (C# keyword or .NET type)
Size (how much memory is used)
Default value
Example:
Integer numbers in C#
Name: int
Size: 32 bits (4 bytes)
Default value: 0
6
8. What are IntegerTypes?
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
8
9. IntegerTypes
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
9
10. IntegerTypes (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
10
11. MeasuringTime – 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("{0} centuries is {1} years, or {2}
days, or {3} hours.", centuries, years, days, hours);
11
14. What are Floating-PointTypes?
Floating-point types:
Represent real numbers
May be signed or unsigned
Have range of values and different precision
depending on the used memory
Can behave abnormally in the calculations
14
15. Floating-Point Types
Floating-point types are:
float (±1.5 × 10−45 to ±3.4 × 1038): 32-bits,
precision of 7 digits
double (±5.0 × 10−324 to ±1.7 × 10308): 64-bits,
precision of 15-16 digits
The default value of floating-point types:
Is 0.0F for the float type
Is 0.0D for the double type
15
16. PI Precision – Example
See below the difference in precision when using
float and double:
NOTE:The “f” suffix in the first statement!
Real numbers are by default interpreted as double!
One should explicitly convert them to float
float floatPI = 3.141592653589793238f;
double doublePI = 3.141592653589793238;
Console.WriteLine("Float PI is: {0}", floatPI);
Console.WriteLine("Double PI is: {0}", doublePI);
16
17. Abnormalities in the
Floating-Point Calculations
Sometimes abnormalities can be observed
when using floating-point numbers
Comparing floating-point numbers can not be
performed directly with the == operator
Example:
double a = 1.0f;
double b = 0.33f;
double sum = 1.33f;
bool equal = (a+b == sum); // False!!!
Console.WriteLine("a+b={0} sum={1} equal={2}",
a+b, sum, equal);
17
18. Decimal Floating-PointTypes
There is a special decimal floating-point
real number type in C#:
decimal (±1,0 × 10-28 to ±7,9 × 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)
18
21. The Boolean DataType
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
21
22. BooleanValues – 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
22
25. The Character DataType
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)
25
26. 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);
26
29. The String DataType
The string data type:
Represents a sequence of characters
Is declared by the string keyword
Has a default value null (no value)
Strings are enclosed in quotes:
Strings can be concatenated
Using the + operator
string s = "Microsoft .NET Framework";
29
30. Saying Hello – Example
Concatenating the two names of a person to
obtain his full name:
NOTE: a space is missing between the two
names!We have to add it manually
string firstName = "Ivan";
string lastName = "Ivanov";
Console.WriteLine("Hello, {0}!n", firstName);
string fullName = firstName + " " + lastName;
Console.WriteLine("Your full name is {0}.",
fullName);
30
33. The ObjectType
The object type:
Is declared by the object keyword
Is the base type of all other types
Can hold values of any type
33
34. Using Objects
Example of an object variable taking different
types of data:
object dataContainer = 5;
Console.Write("The value of dataContainer is: ");
Console.WriteLine(dataContainer);
dataContainer = "Five";
Console.Write("The value of dataContainer is: ");
Console.WriteLine(dataContainer);
34
37. What Is aVariable?
A variable is a:
Placeholder of information that can usually be
changed at run-time
Variables allow you to:
Store information
Retrieve the stored information
Manipulate the stored information
37
40. DeclaringVariables
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> <identifier> [= <initialization>];
int height = 200;
40
41. Identifiers
Identifiers may consist of:
Letters (Unicode)
Digits [0-9]
Underscore "_"
Identifiers
Can begin only with a letter or an underscore
Cannot be a C# keyword
41
42. Identifiers (2)
Identifiers
Should have a descriptive name
It is recommended to use only Latin letters
Should be neither too long nor too short
Note:
In C# small letters are considered different than
the capital letters (case sensitivity)
42
43. Identifiers – Examples
Examples of correct identifiers:
Examples of incorrect identifiers:
int new; // new is a keyword
int 2Pac; // Cannot begin with a digit
int New = 2; // Here N is capital
int _2Pac; // This identifiers begins with _
string поздрав = "Hello"; // Unicode symbols used
// The following is more appropriate:
string greeting = "Hello";
int n = 100; // Undescriptive
int numberOfClients = 100; // Descriptive
// Overdescriptive identifier:
int numberOfPrivateClientOfTheFirm = 100;
43
45. AssigningValues
Assigning of values to variables
Is achieved by the = operator
The = operator has
Variable identifier on the left
Value of the corresponding data type on the
right
Could be used in a cascade calling, where
assigning is done from right to left
45
46. AssigningValues – Examples
Assigning values example:
int firstValue = 5;
int secondValue;
int thirdValue;
// Using an already declared variable:
secondValue = firstValue;
// The following cascade calling assigns
// 3 to firstValue and then firstValue
// to thirdValue, so both variables have
// the value 3 as a result:
thirdValue = firstValue = 3; // Avoid this!
46
47. Initializing Variables
Initializing
Is assigning of initial value
Must be done before the variable is used!
Several ways of initializing:
By using the new keyword
By using a literal expression
By referring to an already initialized variable
47
48. Initialization – Examples
Example of some initializations:
// The following would assign the default
// value of the int type to num:
int num = new int(); // num = 0
// This is how we use a literal expression:
float heightInMeters = 1.74f;
// Here we use an already initialized variable:
string greeting = "Hello World!";
string message = greeting;
48
51. What are Literals?
Literals are:
Representations of values in the source code
There are six types of literals
Boolean
Integer
Real
Character
String
The null literal
51
52. Boolean and Integer Literals
The boolean literals are:
true
false
The integer literals:
Are used for variables of type int, uint, long,
and ulong
Consist of digits
May have a sign (+,-)
May be in a hexadecimal format
52
53. Integer Literals
Examples of integer literals
The '0x' and '0X' prefixes mean a
hexadecimal value, e.g. 0xA8F1
The 'u' and 'U' suffixes mean a ulong or uint
type, e.g. 12345678U
The 'l' and 'L' suffixes mean a long or ulong
type, e.g. 9876543L
53
54. Integer Literals – Example
Note: the letter ‘l’ is easily confused with the
digit ‘1’ so it’s better to use ‘L’!!!
// The following variables are
// initialized with the same value:
int numberInHex = -0x10;
int numberInDec = -16;
// The following causes an error,
because 234u is of type uint
int unsignedInt = 234u;
// The following causes an error,
because 234L is of type long
int longInt = 234L;
54
55. Real Literals
The real literals:
Are used for values of type float, double and
decimal
May consist of digits, a sign and “.”
May be in exponential notation: 6.02e+23
The “f” and “F” suffixes mean float
The “d” and “D” suffixes mean double
The “m” and “M” suffixes mean decimal
The default interpretation is double
55
56. Real Literals – Example
Example of incorrect float literal:
A correct way to assign floating-point value
(using also the exponential format):
56
// The following causes an error
// because 12.5 is double by default
float realNumber = 12.5;
// The following is the correct
// way of assigning the value:
float realNumber = 12.5f;
// This is the same value in exponential format:
realNumber = 1.25e+7f;
57. Character Literals
The character literals:
Are used for values of the char type
Consist of two single quotes surrounding the
character value: '<value>'
The value may be:
Symbol
The code of the symbol
Escaping sequence
57
58. Escaping Sequences
Escaping sequences are:
Means of presenting a symbol that is usually
interpreted otherwise (like ')
Means of presenting system symbols (like the
new line symbol)
Common escaping sequences are:
' for single quote " for double quote
for backslash n for new line
uXXXX for denoting any other Unicode symbol
58
59. Character Literals – Example
Examples of different character literals:
char symbol = 'a'; // An ordinary symbol
symbol = 'u006F'; // Unicode symbol code in
// a hexadecimal format
symbol = 'u8449'; // 葉 (Leaf in Traditional Chinese)
symbol = '''; // Assigning the single quote symbol
symbol = ''; // Assigning the backslash symbol
symbol = 'n'; // Assigning new line symbol
symbol = 't'; // Assigning TAB symbol
symbol = "a"; // Incorrect: use single quotes
59
60. String Literals
String literals:
Are used for values of the string type
Consist of two double quotes surrounding the
value: "<value>"
May have a @ prefix which ignores the used
escaping sequences: @"<value>"
The value is a sequence of character literals
string s = "I am a sting literal";
60
61. String Literals – Example
Benefits of quoted strings (the @ prefix):
In quoted strings " is used instead of ""!
// Here is a string literal using escape sequences
string quotation = ""Hello, Jude", he said.";
string path = "C:WINNTDartsDarts.exe";
// Here is an example of the usage of @
quotation = @"""Hello, Jimmy!"", she answered.";
path = @"C:WINNTDartsDarts.exe";
string str = @"some
text";
61
64. NullableTypes
Nullable types are instances of the
System.Nullable struct
Wrapper over the primitive types
E.g. int?, double?, etc.
Nullabe type can represent the normal range
of values for its underlying value type, plus an
additional null value
Useful when dealing with Databases or other
structures that have default value null
65. NullableTypes – Example
int? someInteger = null;
Console.WriteLine(
"This is the integer with Null value -> " + someInteger);
someInteger = 5;
Console.WriteLine(
"This is the integer with value 5 -> " + someInteger);
double? someDouble = null;
Console.WriteLine(
"This is the real number with Null value -> "
+ someDouble);
someDouble = 2.5;
Console.WriteLine(
"This is the real number with value 5 -> " +
someDouble);
Example with Integer:
Example with Double:
68. Exercises
1. Declare five variables choosing for each of them the
most appropriate of the types byte, sbyte, short,
ushort, int, uint, long, ulong to represent the
following values: 52130, -115, 4825932, 97, -10000.
2. Which of the following values can be assigned to a
variable of type float and which to a variable of
type double: 34.567839023, 12.345, 8923.1234857,
3456.091?
3. Write a program that safely compares floating-point
numbers with precision of 0.000001.
68
69. Exercises (2)
4. Declare an integer variable and assign it with the
value 254 in hexadecimal format. Use Windows
Calculator to find its hexadecimal representation.
5. Declare a character variable and assign it with the
symbol that has Unicode code 72. Hint: first use the
Windows Calculator to find the hexadecimal
representation of 72.
6. Declare a boolean variable called isFemale and
assign an appropriate value corresponding to your
gender.
69
70. Exercises (3)
7. Declare two string variables and assign them with
“Hello” and “World”. Declare an object variable and
assign it with the concatenation of the first two
variables (mind adding an interval). Declare a third
string variable and initialize it with the value of the
object variable (you should perform type casting).
8. Declare two string variables and assign them with
following value:
Do the above in two different ways: with and
without using quoted strings.
The "use" of quotations causes difficulties.
70
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*
(c) 2007 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*