Computer Science in Urdu
Friday, 15 December 2017
Tuesday, 8 August 2017
Primitive Data Types in C++
Data type
is a core concept in programming languages. Computer accepts the input, process
it and return us output. The question is that what types of data is accepted by
computer. Data type defines the set of values and set of operation on those
values. For example in integer data the values will be whole number mean the
numbers without decimal points and fraction. Addition, subtraction,
multiplication division and can cab performed on integer values. On the other
hand if we have character data then the values are alphabet, digit and special
symbols having length one within single quotation marks and concatenations
types of operations can be perform on these.
There are
two types of data a type in c++ language first is primitive and second is user
defined. In this lecture only primitive data types will be discussed and user
defined will be discussed later.
The description
of primitive data types are as following
For more detail visit following video link in Urdu
Thursday, 3 August 2017
First Program in C++
Line 1: #include
is preprocessor directive it an instruction to preprocessor to add header file
in the program. Preprocessor is a part of compiler that is why it is some time
called compiler directive. Preprocessor modify the code before compilation.
Line 3: Namespace
is a collection of classes, objects and variables. Namespaces are used to resolve
the naming collisions. In upcoming videos it will be discussed a lot.
Line 5: Main
function is defined, It is a place where the execution of C program start. int is
return type of main function and main take no parameter that is why empty parenthesis
are used.
Line 6-9: called
program body. There are two instruction in body of main first is cout and second
return. cout is output object which output on the screen console. Program return
0 if it execute successfully.
for more detail visit: https://www.youtube.com/watch?v=KjgDViojR9Y
Syntax of Programming Languages
If we want to
write English paragraph then some rules have to follow, these set of rules are
called grammar. In the same way programmer has to follow set of programming
rules called syntax. Suppose in following instruction is written according to
rules
cout<<”Rao Israr”;
But when these
rules are violated like
cout<<’Rao Israr’;
Called syntax
error, because single quotation marks are used except double.
More details visit: https://www.youtube.com/watch?v=He5e4kEibIo
Language Translator/ Language Processor
As we know that
computer cannot understand high level language directly. We have to translate
high level language into machine readable form. Source code is input for
language translator and machine readable form is output of it. Three types of
translators are used for this purpose
Compiler
Interpreter
Assembler
Compiler takes
source code and converts it into object code (Machine Readable form) as a
whole.
Interpreter takes
one instruction at a time and converts it into machine code
Assembler takes
assembly code and converts it into object code.
For more detail visit : https://www.youtube.com/edit?o=U&video_id=9AN0Z8eSMiE
Source Code VS Object Code
Program written
into high level languages is called source code is called source code. Source code
is not executed by computer directly because computer works on binary numbers. So
source code has to convert into form that computer can understand it. There is
need a translator to convert high level language to machine readable form.
Input of translator is source code and output is machine readable code which is
called object code.
Extension of high
level language is depending on programming language like in C++ extension is
.cpp and .obj for object code.
for more detail visit: https://www.youtube.com/watch?v=uLVxP706XCU
Subscribe to:
Posts (Atom)