presentation zulkaif
TRANSCRIPT
-
8/3/2019 Presentation Zulkaif
1/50
-
8/3/2019 Presentation Zulkaif
2/50
Instuctor:
Yasir Sahib
-
8/3/2019 Presentation Zulkaif
3/50
Crew Members
Asif Ali Rai 2010-EE-417
Hafiz Ashfaq 2010-EE-412
M.Zulkaif Dilawar 2010-EE-422
-
8/3/2019 Presentation Zulkaif
4/50
Programming Language
A vocabulary and set of words,symbols and grammatical rules forinstructing a computer to performspecific tasks is called programminglanguage.
Different programming languagesare available for writing differenttypes of programs
-
8/3/2019 Presentation Zulkaif
5/50
What is best programming
language? Different programming languages provide different
functionalities needed, it is dependent on the requirement,
which programming language to use.
-
8/3/2019 Presentation Zulkaif
6/50
Reason to chose this topic
-
8/3/2019 Presentation Zulkaif
7/50
-
8/3/2019 Presentation Zulkaif
8/50
-
8/3/2019 Presentation Zulkaif
9/50
It was developed by BjarneStroustrup starting in 1979
at Bell laborities
It is used in developingapplication software, device
drivers and entertainment
software such as videogames
-
8/3/2019 Presentation Zulkaif
10/50
-
8/3/2019 Presentation Zulkaif
11/50
Developed by James Gosling at Sun
Microsystems in 1995
Java applications are typically compiled to byte
code (class file) that can run on any Java Virtual
Machine (JVM) regardless of computerarchitecture.
Java is a general-purpose, class based and object
oriented.
-
8/3/2019 Presentation Zulkaif
12/50
-
8/3/2019 Presentation Zulkaif
13/50
It was developed by Microsoft in 1999.
It is a simple, modern, general-purpose,object-oriented programming language.
It provides support for software
engineering principles such as strong typechecking, array bounds checking and
detection of attempts to use uninitialized
variables.
-
8/3/2019 Presentation Zulkaif
14/50
C++, Java and C#(C sharp)
Similarities
Dissimilarities
-
8/3/2019 Presentation Zulkaif
15/50
Operators
All the operators are same in C++, java and
C# with the exception:
In C++:scope resolution operator ( :: )
In java:
instanceof, >>> In C#:
checked , unchecked.
-
8/3/2019 Presentation Zulkaif
16/50
Standard input/output
In C++: Standard input :
cin >> identifier
Standard outputcout
-
8/3/2019 Presentation Zulkaif
17/50
In C#:
Standard input:
System.Console.Readline( );
Standard output:
System.Console.WriteLine( Hello
World );
-
8/3/2019 Presentation Zulkaif
18/50
Comments
A comment is text that the compiler ignores
but that is useful for programmers.
Comments are used to makes the code easier
to read for other programmers
In C++: Two types of comments :
1. single line comment ( // .)
2. Multiple line comment ( /**/ )
-
8/3/2019 Presentation Zulkaif
19/50
In java: Three types of comments:
1. single line comments ( // )2. Multiline comments( /*.*/ )
3. Documentation comments also called
javadoc comment ( /** .. */ )
In C#:
Three types of comments:1. single line comments( //. )
2. Multiline comments ( /*.*/ )
3. XML tags comments ( ///.. )
-
8/3/2019 Presentation Zulkaif
20/50
Identifier
The Identifier are the names used to presentvariable, constants ,types, functions and
labels in the program.
Identifier is an important feature of allcomputer languages
-
8/3/2019 Presentation Zulkaif
21/50
Identifier in C++
An Identifier in C++ may consist of 31
characters
The Identifier name must consist of only
alphabetic characters, digits or underscores.
The first character must be an alphabetic or
underscore ( _ ).The reserved word can not be used as
identifier name.
-
8/3/2019 Presentation Zulkaif
22/50
Identifier in Java
An Identifier in java may consist of anynumber of characters.
The identifier name must consist of only
alphabetic characters, digits, underscores
or dollar signs.
The first character must be alphabetic
character, underscore ( _ ) or dollar sign
($).
-
8/3/2019 Presentation Zulkaif
23/50
Identifier in C#
The Identifier name must consist of onlyalphabetic
characters, digits or underscores
Identifier must begin with alphabet orunderscore.
Identifier name may be a C# keyword if we startIdentifier name with @ sign.
Use of a C# variable before initialization is a
compile-time error.
-
8/3/2019 Presentation Zulkaif
24/50
Data Types
In C++ int, signed int, unsigned int, short
int,, long int, double, float , bolean
In Java byte, int, long int, double, float,bolean.
In C# all the data types are similar to C++
except byte.
-
8/3/2019 Presentation Zulkaif
25/50
Constants
Constant is a quantity that cannot bechanged during program execution.
-
8/3/2019 Presentation Zulkaif
26/50
In C++:const data_type Identifier = value;
#define data_type identifier value
In Java:
publicfinal data_type Identifier =value;
-
8/3/2019 Presentation Zulkaif
27/50
In C#:
const data_type Identifier = value;
We can also initialize a constant variable
at runtime using readonly keyword in C#.
For example:readonly data_type identifier;
-
8/3/2019 Presentation Zulkaif
28/50
Preprocessing
Preprocessing is done beforecompilation. Preprocessor directive is an
instruction given to the compiler before
the execution of actual program.
-
8/3/2019 Presentation Zulkaif
29/50
In C++:
Conditional preprocessing
#if, #else, #ifdef, #endif
Include preprocessor :
#include
Macros :
#define , #undef
-
8/3/2019 Presentation Zulkaif
30/50
In Java:
There is no preprocessing in Java, in Java
import keyword is used to access class from
the library.
import javax.swing.JOptionPane; // make a
single class visible
-
8/3/2019 Presentation Zulkaif
31/50
In C#:
There is no include preprocessor
(#include) in C#
. We useusing keyword to do that
e.g. using System;
-
8/3/2019 Presentation Zulkaif
32/50
Selection Structure
A Selection Structure selects a statement
or set of statements to execute on the basis
of a condition.
For example:
if statement, if_else Statement,
Switch statement , Conditional operator (
ternary Operator )
There is no difference in C++, java and
C# regarding Selection Structure.
-
8/3/2019 Presentation Zulkaif
33/50
Repetition Structure
A type of control structure that repeats astatement or set of statements.
In C++
Three types of looping structure:
for loop, while loop, do while loop
In Java and C#: Four types of looping structure:
for loop, while loop, do while loop,
foreach loop
-
8/3/2019 Presentation Zulkaif
34/50
Arrays
An array is a group of consecutive memory
locations with same name and type.
In C++: Types of array:
1- One-Dimensional Array
Data_type identifier[ length];
2- Two Dimensional Array
Data_type identifier[Rows][Cols];
-
8/3/2019 Presentation Zulkaif
35/50
3- Multidimensional Array
Data_type identifier[a][b]..[c];
It does not perform bound checking.
We can not assign an array to other using
assignment operator
In java
Types of array:Same as C++.
Unlike C++ I t throws runtime exception and
perform array bound checking.
-
8/3/2019 Presentation Zulkaif
36/50
In C#:
When declaring an array, the square brackets([]) must come after the type, not the identifier
Types of array:
1- One-dimensional arrays
data_type [ ] array_name;
array_name = new data_type[ size ];
2- Multidimensional arrays or Rectangular
arraysdata_type [ , ] array_name = new
data_type[ size , size];
-
8/3/2019 Presentation Zulkaif
37/50
3- Arrays of arrays ( Jagged arrays )
data_type [ ] [ ] array_name = newdata_type[ size,size ];
4- Mixed arrays:data_type [ ] [ , ] array_name;
-
8/3/2019 Presentation Zulkaif
38/50
Functions
A function is a named block of code that
performs some action.
In C++ functions can be made global or local. In java and C# functions are named as
methods.
In java and C# there is no global method or
global data member.
C++, Java, C# all provides functions /methods
overloading.
-
8/3/2019 Presentation Zulkaif
39/50
Pointers
A pointer is a variable that is used to store
a memory address C++ supports pointers that improve
performance but weaken security
Java and C# does not have pointer. Boththese languages use reference instead of
pointer variable.
-
8/3/2019 Presentation Zulkaif
40/50
Memory Management
In C++ any memory that is allocated on the heap
( using new) must be explicitly freed by the
programmer (using delete).
Forgetting to free memory leads to memory
leaks.
Java and C# provides garbage collection, meaning
that memory is freed automatically when it is nolonger reachable by any references
It can lead to pauses in execution while the
garbage collector runs
-
8/3/2019 Presentation Zulkaif
41/50
Classes and Objects
A collection of objects with same properties and
functions is know n as class.
An object is a collection of data and functions.
Inheritance is a programming technique that isused to reuse an existing class to build a new
class.
In C++: C++ defines 3 access specifier:
1- public 2- private
3- protected
-
8/3/2019 Presentation Zulkaif
42/50
If no access specifier is specified then bydefault access specifier is private.
C++ supports multiple inheritance,
operator overloading . C++ has constructor, destructor, friend
functions.
-
8/3/2019 Presentation Zulkaif
43/50
In Java Java defines 4 access levels for class members
1- public 2- private
3- protected 4- default ( no
specifier)
If no acess specifier is specified then the defaultaccess level is assumed; that is, the member is
visible to all code in the package.
Java does not use semi colon at the end of classdefinition..
-
8/3/2019 Presentation Zulkaif
44/50
There is no destructor in Java.
Java does not support operator overloading.
Java does not have friend methods.
In C#
There are five acess specifier:
1- public 2- private
3- protected 4- internal
5- protected internal
-
8/3/2019 Presentation Zulkaif
45/50
The default access level for a nested class if no
access modifier is specified is private. The default access level for a non-nested class if
no access modifier is specified is internal.
C# does not use semicolon at the end of class
definition
Objects in C# can only be created using new
key word
C# does not support multiple inheritance C# does not support operator overloading.
-
8/3/2019 Presentation Zulkaif
46/50
It does not have friend methods (functions)
C# does not separate class declaration
and member function definitions.
-
8/3/2019 Presentation Zulkaif
47/50
C++ compiler
-
8/3/2019 Presentation Zulkaif
48/50
Java compiler
C li
-
8/3/2019 Presentation Zulkaif
49/50
C# complier
-
8/3/2019 Presentation Zulkaif
50/50