SlideShare a Scribd company logo
1 of 96
Download to read offline
Jubair Ahmed Junjun
B.Sc in Computer Science & Engineering(CSE)C++Lecture.
https://www.youtube.com/c/JubairAhmedJunjun/videos?view_as=subscriberYouTube :
C++
• C++ is Known to be a very powerful Computer programming language.
• C++ is a general purpose,case sensitive,OOP(Object oriented programming language).
Uses of C++
• It's use to developed game engines,games and desktop apps,art applications,music
players etc.
• C++ is being highly used to write device drivers and other software.
Jubair Ahmed Junjun
B.Sc in Computer Science & Engineering(CSE)
History of C++
• C++ programming language was developed
in 1980 by Bjarne Stroustrup at bell
laboratories of AT
• Bjarne Stroustrup is known as the founder of
C++.
• C++ was derived from c,and is largely based
on it.
• 4th most used language
Overlap of C,C++ and Java
Jubair Ahmed Junjun
B.Sc in Computer Science & Engineering(CSE)
C++
C Java
Feature of C++
• Simple
• Mid Level Programming Language.
• Rich - Library
• Memory management.
• Fast speed.
• Pointers.
• Recursion
• OOP(Object oriented programming).
• Compiler based. Jubair Ahmed Junjun
B.Sc in Computer Science & Engineering(CSE)
প্রোগ্রোম :ক োনএ টি সমসযো সমোধোননর জনয ম্পিউটোনরর
ভোষোয়(0,1) ম্পিম্পিত ম্পনর্দ নের সমম্পিন কেগ্রোমবনি।
প্রোগ্রোমমিং ভোষো :
কেোগ্রোমরচনোর জনয ম্পবম্পভন্ন (েব্দ,বর্দ,অং ,সংন ত) এবং এগুনিো
ম্পবনযোনসর ম্পনয়মম্পমম্পিনয় ততম্পর রোহয় কেোগ্রোম্পমংভোষো।নমমন:
C,C++,Java,Assemblylanguageetc.
প্রোগ্রোম(P R O G R A M )
ও
প্রোগ্রোমমিং
ভোষো(P R O G R A M M I N G L A N G U A G E )
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
1.Source code and Object code
2.What is Translator?
3.Types of Translator
4.How to Translator
work(assembler,compiler,interpret
er)
TOPIC :
TRANSLATOR
(অনু বোদক প্রোগ্রোম)
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Soursecode &ObjectCode
SOURCECODE
উচ্চতর ভোষোয় ম্পিম্পিত কেোগ্রোমন ই কসোসদ ক োড (source
code) বনি।
OBJECT CODE
কমম্পেন ভোষোয় ম্পিম্পিত ক োডন object code বিো হয়।
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
TRANSLATOR (অনুবোর্ কেোগ্রোম)
কম কেোগ্রোম কসোসদ ক োড (source code) ক object code এ পম্পরর্ত নর,তোন TRANSLATOR(অনুবোর্ কেোগ্রোম) বনি।
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Assembler(অযোসেম্বলোর)
কম অনুবোর্ কেোগ্রোম অযোসেম্বমল ভোষোয় ম্পিম্পিত কেোগ্রোমন কমম্পেন ভোষোয় রূপোন্তর নর,তোন ই Assembler(অযোসেম্বলোর) বনি।
সুম্পবধো :
➢ কননমোম্পন ক োডন কমম্পেন ভোষোয় পম্পরর্ত নর।
➢ কেোগ্রোনম ভূ ি থো নি ErrorMessage ের্েদন নর।
➢ কেোগ্রোনমর ভূ ি সংনেোধন রো সহজ।
➢ ম্পডবোম্প ং এবং কটম্পটং এর োজ সংনেোধন রো সহজ।
➢ কমনমোম্পরনত ম জোয় ো কনয়।
Assembly
language
program
Assembler
Machine
Language
অসুম্পবধো :
➢ কেোগ্রোম ম্পনবদোহ রোর জনয সময় কবম্পে েনয়োজন হয়।
➢ িোইিোনরর তু িনোয় (5-25)গুন সময় কবম্পে কনয়।
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Compiler(কম্পোইলোর)andInterpreter(ইন্টোরসরটোর)
COMPILER( িোইিোর)
সিূর্দ কেোগ্রোমন এ সোনথ অনুবোর্ নর।
কম সব কেোগ্রোম্পমং ভোষোন িোইি রো হয় : --
C,C++,object-
c,C#,Pascal,COBOL,ADA,Visual
Basic,Smalltalk etc.
INTERPRETER(ইন্টোরনেটোর)
সিূর্দ কেোগ্রোমন এ িোইন এ িোইন নর অনুবোর্ নর।
কমসব কেোগ্রোম্পমং ভোষোন ইন্টোরনেটোর রো হয়
: Basic,php,python,Perl,Ruby,javascript
etc.
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
কোসেরধোপেমূহ
COMPILER(কম্পোইলোর) INTERPRETER(ইন্টোরসরটোর)
Source
code Compiler
List of error
Object code
1st Step :
2nd Step :
Input
Object
code
Output
Source
code Interpreter Output
Input
Total program translate at a timethen
execute
Line by line translate then
execute
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
কম্পোইলোরএবিং ইন্টোরসরটোসরর মসধযপোর্থকয
কম্পোইলোর ইন্টোরসরটোর
➢ সিূর্দ কেোগ্রোমন এ সোনথ অনুবোর্ নর।
➢ কেোগ্রোনমর সব ভূ ি এ সোনথ ের্েদন নর ।
➢ িোইিোর দ্রুত োজ নর।
➢ এ বোর কেোগ্রোম িোইি রোর পর পরবতী িোইি রনত হয় নো।
➢ বড় ধরননর ম্পিউটোনর কবম্পে বযবহোর হয়।
➢ এ িোইন এ িোইন নর অনুবোর্
নর।
➢ এ িোইন নর ভূ ি ের্েদন নর।
➢ ধীনর োজ রো।
➢ েম্পতটি োনজর পূনবর্ অনুবোর্ রোর
েনয়োজন হয়।
➢ মোইনরো ম্পিউটোনর কবম্পে বযবহোর
রো হয়।
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
অযোি ম্পরর্ম(Algorithm)
কম পদ্ধম্পতনত ক োন এ টি সমসযোন ধোনপ ধোনপ সমোধোন রো হয়,তোন অযোলগমরদম(Algorithm) বনি ।
কমমন : ম্পতনটি সংিযোর কমো ফি ম্পনর্দয় রোর অযোি ম্পরর্ম(Algorithm) ।
Step-1: Start
Step-2: Read/Input
Step-3: Summation of Three numbers.
Step-4: Print/Output
Step-5: End
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
অযোলগমরদম(Algorithm)
প্লখোর মনয়ম /ববমিষ্ট
এবিংেুমবধো
ম্পনয়ম/তবম্পেি :
➢ সহজনবোধয হনত হনব।
➢ েনতয টি ধোপ স্পি হনত হনব,মোনত কম ক োন কেোগ্রোমোর সহনজ বুঝনত পোনর।
➢ ধোনপ ধোনপ সমসযোর সমোধোন রনত হনব।
➢ বযোপ ভোনব েনয়ো রোর উপনমো ী হনত হনব।
সুম্পবধো :
➢ কেোগ্রোনমর উনযযেয সহনজ বুঝনত পোনর।
➢ ভূ ি ম্পনর্দনয় সোহোনময নর।
➢ কেোগ্রোম পম্পরবতদ ন ও পম্পরবধদনন সোহোময নর।
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
প্লোচোটথ
(Flowchart)
কম পদ্ধম্পতনত ক োন কেোগ্রোমন ম্পচত্র বো েম্পতন র মোধযনম ে োে রো হয়।তোন কলোচোটদ বনি।
প্লোচোটথ
➢ System এ কডটোর
েবোহ েম্পরয়ো রর্,সংরক্ষর্ ও
ফিোফি ের্েদননর
ম্পর্ ম্পচম্পিতহয়,তোন System
Flowchartবনি।
➢ কেোগ্রোম রচনোর
সময় কম Flowchartততম্পর
রো হয়,তোন Program
Flowchartবনি।
System
Flowchart
Program
Flowchart
Provided by : Jubair Ahmed Junjun
B.Sc in Computer Science & Engineering(CSE)
Basic
Flowchart
symbolsand
meaning
রতীক(Symbol) অর্থ(Meaning)
End , Start
Process
Decision
Flowline
Connector
Input/output
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Special Symbolsof Flowchart
Mult-Document
Preparation
Storageof finished
goods
Logical OR
Delay
ManualOperation
DataStored
Database
Predefinedprocess
Alternateprocess
Document
Manualinput
Materialhandling
Storageof raw
materials
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
সমসযো : ম্পতনটিসংিযোরকমো ফিম্পনর্দয় রোর
কলোচোটদ (Flowchart) ম্পিি।
Start
Input a,b,c
Sum = a+b+c
End
Output sum
Step-1 : Start
Step-2 : Read/Input
Step-3 : Summationof Three
numbers.
Step-4 : Print/Output
Step-5 : End
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
অযোি ম্পরর্ম(Algorithm) ওকলোচোটদ (Flowchart)
এর মনধয পোথ য
অযোলগমরদম(ALGORITHM) প্লোচোটথ (FLOWCHART)
➢ধোনপ ধোনপ সমোধোন নর।
➢বর্দনো ম্পনভদ র।
➢বুঝনত সময় কবম্পে িোন ।
➢কেোগ্রোম েবোনহর ম্পর্ সহনজ বুঝো মোয় নো।
➢কেোগ্রোনমর ভূ ি দূর রো ঠিন।
➢ সোংন ম্পত ম্পচি বো েতীন ন রমোধযনমসমসযো সমোধোন রোন কলোচোটদ বনি।
➢ ম্পচত্র ম্পনভদ র।
➢ বুঝনত তু িনোমূি সময় মিোন ।
➢ সহনজবুঝো মোয়।
➢ কেোগ্রোনমরভূ িদুর রো সহজ।
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
সুনডোন োড(Pseudo code)
সুনডো(Pseudo) ম্পগ্র েব্দ।অথদ ছদ্ম বো ৃ ম্পত্রম।
কর্িনত কেোগ্রোম্পমং ক োড এর মত মনন হনিও এটি ম্প ন্তু ক োন কেোগ্রোম্পমং ক োড নয়।এটি হনিো মুিত ক োড রোর পূনবদ এ টি রোফ বো িসড়ো কটক্সট ভোসদন
ততম্পর রোর েম্পরয়ো।
কমমন : ম্পতনটি সংিযোর কমো ফি ম্পনর্দয় রোর সুনডোন োড ম্পিি।
Input A
Input B
Input C
Total = A+ B+ C
Print Total
Stop
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
কেোগ্রোমততম্পররধোপসমূহ
কেোগ্রোনমর সোহোনময ক োন সমসযো সমোধোন রনত হনি তগুনিো ধোপ অনুসরন রনত হয়,আর এই ধোপসমূহন ই কেোগ্রোম ততম্পরর ধোপ বিো হয়।
েমেযো মনমদথ ষ্টকরণ েমেযো মবসেষণ প্রোগ্রোম মিেোইন প্রোগ্রোম উন্নয়ন প্রোগ্রোম বোস্তবোয়ন
প্রোগ্রোম রক্ষণোসবক্ষণ
✓সমসযোম্পচম্পিত রর্
✓সমসযোসিন দ তথযসংগ্রহ
✓ ইনপুটআউটপুটসনোক্ত
✓ ম্পিউটোনররকমনমোম্পর ম্পনধদোরর্
✓অযোি ম্পরর্ম
✓কলোচোটদ
✓কেোগ্রোম ক োম্পডং।
✓Algorithm,flowchart
,Pseudo code কথন কেোগ্রোম্পমং
ভোষোয় কেোগ্রোম ম্পিিনত হনব।
✓কটম্পটং
✓ম্পডবোম্প ং
✓র্ীর্দনময়োর্ী বযবহোরম্পনম্পিত রর্।
✓হোডদ ওয়োর ,সফ্টওয়োর ওডকুইনমন্ট রক্ষর্োনবক্ষর্।
✓ োমদ োম্পরতো ভীরভোনব পমদনবক্ষর্।
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
ম্পডবোম্প ং(Debugging)and Error
বো েনব্দর অথদ ভূ ি।নেোগ্রোনমর ভূ িগুনিোন বো বিো হয়।
আর কেোগ্রোনম ক োন ভূ ি পোওয়ো ক নি তো সংনেোধন রোন বিো হয় ম্পডবোম্প ং।
Syntax error
(বযো রর্ তভূ ি)
Logical
error(মুম্পক্তসম্মত ভূ ি)
Runtime
error(তথয তভূ ি)
➢Types of Error
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
➢Error : Any Unexpected output is called error.
C++Programএবিং এর মবমভন্ন অিংি ।
#include<iostream>
using namespace std;
int main()
{
cout<<"Hello World";
return 0;
}
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Input output stream.এটিএ টি কহডোর ফোইি#include এর সোহোনময এটিন
কেোগ্রোনম সংমুক্ত রো হয়।
রসতযক প্রোগ্রোমমিং লযোঙ্গুসয়সের মকছু লোইসেমর ফোিংিনআসছ । প্তমমন মে++এরও আসছ । স্ট্যোন্ডোিথ মে ++লোইসেরীসতেমস্ত উপোদোনগুমল র
কোিকরো আসছ , যোসক namespace stdবলো হয়।
লোইসেমর ফোিংিন এররসতযকটি উপোদোনগুমলর বযবহোর প্যোগযতো অেথ ন করোর েনযই usingnamespace std;বযবহোরকরো হয়।
int একটি keyword ।কম্পোইলএবিং মনর্ বোসহর েময় মে/মে++ এ main() ফোিংিন
প্র্সক শুরু হয় ।তোই প্রোগ্রোসম এ ফোিংিনঅবিযই মলখসত হসব ।
cout<<হসে Standardoutputstream.
এটি দ্বোরো মমনটসর প্কোন মকছু রদিথন করো হয় ।Keyword,Returning 0 means
a successfultermination.
Escapesequence/Backslashcharacter
C++ কেোগ্রোনম ম্প ছু Backslash character বযোবোম্প র রো হয় ।মো ফোংেন ম্পহনসনব োজ নর ।
Character Escape Sequence Meaning
a (Alert)Bell
b Backspace
f Form feed
n Newline
r Carriagereturn
t HorizontalTab
v Verticaltab
o Null character
' Single quote
" Double quote
 Backslash
? Question mark.
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Comment
Comment হনিো কসোসদ ক োড ম্পিিোর সময় ম্পননজর বো অনযজননর জনয এ টি কনোড ততম্পর রো ।
Comment বযবহোর এর উসেিয :
➢ কেোগ্রোনমর উনযেয সহনজ বুঝোননোর জনয ।
➢কেোগ্রোম সিন র্ বর্দনো ম্পিনি রোিোর জনয ।
➢কেোগ্রোনম ক োন িোইন ম্প বুঝোয় তো বুঝোর জনয ।
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Comment এর
রকোর
i.Single line comment :
➢ কেোগ্রোনমর কমক োন জোয় োয় বযবহোর রো মোয় ।
➢ // ম্পর্নয় শুরু রনত হয় ।
➢ // ম্পর্নয় ম্প ছু শুরু রনি িোইিোর তো এম্পড়নয় মোয়।
Example :
#include<iostream>
usingnamespace std;
int main()
{
//printing hello world.
cout<<"Hello World";
return 0;
}
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
ii.Multiplelinecomment:
Ø প্রোগ্রোসমর প্য প্কোন েোয়গোয় বযবহোর করো যোয় ।
Ø শুরু হয় /* মদসয়,প্িষ হয় */ মদসয় ।
Example:
/*
------------------
It's multiplelinecomment.
------------------
*/
Provided by: JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
কটোন ন(Token)
A token is the smallest element of a program that is meaningful to the compiler.
Types of Token
✓ Keywords : int,float,while
✓ Identifiers : sum,main
✓ Constants : 100,555
✓ Strings : “JAJSoftTech”
✓ Special Symbols : [] () {}, ; * = #
✓ Operators : +,-,*,/,%
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
asm continoue float new signed try
auto default for operator sizeof union
break delete friend private static unsigned
case do go to protected struct virtual
catch double if public switch void
char else inline register template typedef
class enum int return this volatile
const extern long short throw while
Keywordহনিো এমন ম্প ছু সংরম্পক্ষতেব্দ,মোএ টি ম্পনম্পর্দ িঅথদ বহর্ রনবএবং কেোগ্রোনম এ টি ম্পনম্পর্দ ি োমদ সিোর্ন রনব।
মে++ প্রোগ্রোমমিং এ Keyword েমূহ :
Keyword
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Keyword বযবহোনরনর ম্পনয়ম
➢Keyword িননো variable বো চিন র নোম ম্পহনসনব বযবহোর রো হয় নো।
➢Keyword সমূনহর েম্পতটি বর্দ small letterএর হয়।
➢মম্পর্ িননো দুটি keyword এ সোনথ বযবহোর রনত হয়,তোহনি মোঝিোনন ফো োাঁ স্থোন থো নত হনব।
➢keyword সমূনহর নোম এ টি এ েব্দ,অথদোৎ মোনঝ ক োন ফোাঁ ো স্থোন থোন নো।
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Identifier
Identifiers are used as the general terminology for naming of variables, functions and
arrays. Some identifiers are used:
A-Z,a-z,0-9,$,_
Some valid and non-valid identifier example
Valid identifiers Non-valididentifiers
Number1,Int,std_name 1number,int, std name
Keyword(Reservedword)
Space can’tbe used
Digit can not be used
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Constant
Constants are also like normal variables. But, only difference is, their values can
notbe modified by the program once they are defined. Constants refer to fixed
values.
Types of Constants :
✓Integerconstants– Example: 0, 1, 1218, 12482
✓Real or Floating point constants– Example: 0.0, 1203.03, 30486.184
✓Octal &Hexadecimalconstants– Example: octal: (013)8 = (11)10,Hexadecimal:(013)16= (19)10
✓Characterconstants-Example: ‘a’,‘A’, ‘z’
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
String&SpecialSymbols
In C, a string is a sequence of characters.
chargreeting[6]= {'H', 'e', 'l', 'l', 'o', '0'};
chargreeting[]= "Hello";
Special Symbols :The following special symbols are used in C having some special meaning and thus,
cannot be used for some other purpose.[] () {}, ; * = #
Brackets[]: Openingandclosing bracketsareused as arrayelement reference.These
indicatesingle and multidimensionalsubscripts.
Parentheses():These special symbols areused to indicatefunction calls andfunction
parameters.
Braces{}: These openingandendingcurly braces marksthestartandendofa block of
code containingmorethanone executable statement.
comma (, ): Itis used to separatemorethanonestatements like forseparating
parametersinfunction calls.
semi colon : It is anoperatorthatessentially invokes something called aninitialization
list.
asterisk(*): It is used to create pointervariable.
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Variable/ চলক
কেোগ্রোনম ক োনএ টি নোম ম্পর্নয় মম্পর্ তোরমনধয data রোিো হয়,তনবঐ নোমটিন চি বনি।
কমমন : number 1 =10;
Name= "JAJSoftTech"
Variable ম্পিিোর ম্পনয়ম :
1.Variableএর নোম বর্দ (A-Z,a-z).অঙ্ক(0,1....9),আন্ডোরনকোর(_)এবং ডিোর ম্পচি ($)বযবহোর রো হয়।
Valid Invalid
first_name "JAJ SoftTech"
Id1 JAJSoftTech@
Code1022 #JAJSoftTech
$JAJSoftTech
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
2.Variable এর নোম ম্পডম্পজট বো অঙ্ক ম্পর্নয় শুরু হনত পোনর নো।
Invalid Valid
1number _number1,
number,
a2b
3.Keywordবো function কভম্পরনয়বনির নোম ম্পহনসনব বযবহোর রো মোয় নো।
Valid Invalid
Main main
Float float
for
4. Variable এর নোনমর মোনঝ ক োন ফোাঁ ো স্থোন থোন নো।
Invalid Valid
First number first_number
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Operator
C++ ভোষোয় োম্পর্ম্পত এবং কমৌম্পক্ত োজ রোর জনয তগুনিো ম্পবনেষ ম্পচি (+,-*,/) বযবহোর রো হয়,এনর্রন অপোনরটর বনি।
A + B = 7
Operand
Expression
Constand
Operator
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
TypesofOperator
➢Arithmetic Operator
➢AssignmentOperator
➢Relational Operator
➢Logical Operator
➢Conditional Operator
➢Unary Operator
➢Bitwise operator
➢Special Operator
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
ArithmeticOperator
Operator কোে উদোহোরণ ফলোফল
+ প্যোগ করো X=15+6 21
- মবসয়োগ করো X=15-6 9
* গুণ করো X=15*6 90
/ ভোগ করো X=15/6 2
% ভোগসিষ X=15%6 3
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
গোমণমতক ফরমুলোসক এসেসরিসনরূপোন্তর :
গোমণমতক এেসরিন েমতু লয মে এেসরিন
X = a2-2ab + b2 X=a*a– 2*a*b + b*b;
Area =√ s(s - a)(s - b)(s - c) Area = sqrt(s*(s-a)*(s-b)*(s-c));
x = Y X ==Y;
Y=AB2+C Y = A*B*B+C;
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
AssignmentOperator
Operator Example Full meaning
= X = x+5 X=x+5
+= X+=5 X=x+5
-+ X-=5 X=x-5
*= X*=y X=x*y
/= X/=5 X=x/5
%= X%=5 X=x%5
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
RelationalOperator
Operator Meaning Example Result
== Equal to 5==2 False
!= Not equalto 5!= 2 True
< Lessthan 5<2 False
> Greater than 5> 2 True
<= Lessthan or equal
to
5<=2 False
>= Greater than or
equalto
5>=2 True
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
LogicalOperator
Operator Name Example
&& Logical AND A&&B
|| Logical OR A||B
! Logical NOT !a
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Conditional
Operator
A ternary operator pair "?:" is available in c construct
conditional expression of the forms.
Exp1 ? Exp2: Exp3;
Example :
If(a>b)
X=a;
Else
X=b;
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
UnaryOperator
Operator Meaning
+ Unary Plus
- Unary minus
++ Increment
-- Decrement
! Logical implement
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
& Addressofoperator
BitwiseOperator
Operator Meaning Example
& Binary ANDOperator (A& B) = 12, i.e., 00001100
| Binary OR Operator (A| B) = 61, i.e., 0011 1101
^ Binary Ex-OR Operator (A^ B) = 49, i.e., 0011 0001
>> Binary Right Shift Operator A >>2 = 15 i.e., 00001111
<< Binary LeftShift Operator A <<2 = 240 i.e., 1111 0000
~ Binary One'sComplement
Operator
(~A) = ~(60), i.e,. 1100 0011
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Data Type in C++
Data ’রধরর্ন ইসোধোরর্ত কডটো টোইপ বিো হয় ।
Datatypes in C++
User define data-type Build in datatype Derive data-type
Integer Floating point number
int char float doublevoid bool
• Structure
• Union
• Class
• enumeration
• Array
• Pointer
• Function
• etc
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Modifiers
Variable এ কম কডটো টোইপ বযবহোর রো হয়,কসগুনিো Modifier রো ।
4 types of Modifiers in C++
✓ signed.
✓ unsigned.
✓ long
✓ short
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Data Type Size(in bytes) Range
shortint 2 -32768 to 32767
unsigned short int 2 0 to 65535
unsigned int 4 0 to 4294967295
int 4 -2147483648to2147483647
unsigned long int 4 0 to 4294967295
long long int 8 -(2^63)to (2^63)^-1
unsigned long long int 8 0 to 18446744073709551615
signed char 1 -128 to 127
unsigned char 1 0 to 255
float 4 3.4E - 38 to 3.4E + 38
double 8 1.7E-308 to 1.7E +308
long double 10 3.4E - 4932 to 3.4E + 4932
wchar-t 2 to 4 1 wide character
long int 4 -2147483648to2147483647
Bytes and Range
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
FormattingoutputinC++
ক োন এ টি Data type ক অনয এ টি Data type এ রূপোন্তর রো ।
Typecasting
▪showpoint
▪noshowpoint
▪fixed
▪setw()
▪setprecision
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
DecisionmakingStatement
Decision making statement is depending on the condition block need to be executedor
not which is decided by condition.
If the condition is "true" statement block will be executed,if condition is "false"then
statement block will not be executed.
Therearethreetypesof decision makingstatement:
➢ if
➢ if-else
➢ switch
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
if -Statement
Basic Syntax :
if(condition)
{
.......
.......
}
Condition
ConditionBlock
Flowchart:
if condition
is false
if condition
is true
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
elseStatement
Condition
Condition Block
Flowchart:
if condition
is false
if condition
is true
else body
Basic Syntax :
if(condition)
{
.......
.......
}
else
{
…........
.........
}
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
if else/elseif Statement
Basic Syntax :
if(condition)
{
…......
........
}
elseif(condition)
{
….......
..........
}
elseif(condition)
{
…........
…......
}
else
{
…...
…...
}
if
condition
else if 2
Flowchart:
false
else if
condition
2
else if
condition 1
if body
else if 1
else body
false
false
true
true
true
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
SwitchStatement
Statementn
Statement3
Statement2
Statement1 Break
Break
Break
Expression
Case 1
Case 1
Case 1
default
Basic Syntax :
switch(expression/variable)
{
case 1:
//statements
break;
case 1:
//statements
break;
case 2:
//statements
break;
.
.
default:
//statements
}
Flowchart:
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Loops in C++
A loop statementallowsusto executeastatementorgroupof statementsmultiple times.
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
forloop
while loop
do...while loop
nested loop
Sr.No Loop Type & Description
1 while loop
Repeats a statementor group of statements while agiven conditionis true. It tests the condition
beforeexecutingthe loop body.
2 for loop
Executes a sequence of statementsmultiple times andabbreviatesthe code thatmanagesthe loop
variable.
3
do...while loop
Itis more like a while statement, except thatit tests the conditionatthe end of theloop body.
4 nestedloops
You canuse oneor moreloops inside any other while, for,or do..while loop.
C++programminglanguageprovidesthefollowingtypesofloopsto handle looping
requirements.
initialization;
while(condition)
{
statement(s);
increment/decrement;
}
while loop
Basic Syntax :
Condition
code Block
Flowchart:
if condition
is false
if condition
is true
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
initialization
initialization;
do {
statement(s);
increment/decrement;
} while( condition );
Basic Syntax :
do...while loop
Condition
Code Block
if condition
is false
if condition
is true
Flowchart:
initialization;
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
for loop
Basic Syntax :
for(init; condition; increment)
{
statement(s);
}
Condition
code Block
Flowchart :
if condition
is false
if condition
is true
initialization
increment
for ( init; condition; increment ) {
for ( init; condition; increment ){
statement(s);
}
statement(s);
}
do{
statement(s);
do{
statement(s);
}while(condition);
}while(condition);
while(condition){
while(condition){
statement(s);
}
statement(s);
}
nested loops in c++
while loop do...while for loop
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Basic Syntax :
JumpStatementinC++
jump statements are used to interrupt the normal flow of program.
Types of Jump Statements :
•Break
•Continue
•GoTo
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
goto label;
- - - - - - - - - -
- - - - - - - - - -
label:
- - - - - - - - - -
- - - - - - - - - -
int a=0;
while(a<10)
{
a++;
if(a==5
continue;
cout << "nStatement " << a;
}
cout << "nEnd of Program.";
}
Thebreakstatementis
usedinside loopor switch
statement.
Jump Statements
break continue Go to
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Basic Syntax :
while(a<=10)
{
if(a==5)
break;
cout << "nStatement " << a;
a++;
}
cout << "nEnd of Program.";
}
The continue statement is also
used inside loop.
The goto statement is a jump
statement which jumps from one
point to another point within a
function.
Array
An array is a collection of variable of same data type.
Array declaration :
data_typearray_name[array-size]
Example : int mark[100]
Array initialization:
int marks[0]= 80;
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Initialization array during declaration :
int marks[5]= {80,65,75,82,45};
TypesofArray
Array
Multi-dimentional arraysOne - dimentional array
or
Three dimentionalarrayTwodimentional array
or
matrix arrays
Linear arrays
Exm : int marks[10];
Exm : int marks[2][3]; Exm : int marks[2][3][2];
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Pointer(*)
Pointer is a variable that stores/points the address of another variable.
Pointer এমন এ টি variable মোর মনধয অনয এ টো variable এর address, store ম্প ংবো points রনত পোম্পর ।
Declarationof pointers:
data_type * variable_name.
Example : int * p;
asterisk symbol
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Symbolofpointer
Therearetwosymbols of pointer:
i.&(address of variable) :Thissymbol used to get the address ofthe variable .
ii. asterisk (*): It is used to create pointer variable.
int x = 5;
int *p;
cout<<x<<endl;
cout<<&x<<endl;
cout<<p<<endl;
cout<<*p<<endl;
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Function
A function is a group of statement that perform a particular task.
ক োন এ টি ম্পনম্পর্িদ োজ সিোর্ননর জনয অনন গুনিো statement এর সমন্বনয় ঠিত single এ টি unit ক Function বনি ।
Function
Libraryfunction
User-definedfunction▪ কম function গুনিো ততম্পর রো আনছ ।
get ch()
toupper()
toloweer()
pow()
sqrt()
▪ কম function গুনিো ততম্পর রো হয়।
Provided by:JubairAhmed Junjun
B.ScinComputerScience&Engineering(CSE)
Declarationof a function
void addition(int a,int b)
{
int sum = a+b;
cout<<sum;
}
Return type Function name
Parameter
Body of
the
function
Advantageoffunction :
➢ Code Reusability.
➢ Can use the same function for different
inputs.
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Function Overloading
• Function overloading হনিো এমন এ টো process কমিোনন এ র অম্পধ ফোংেননর নোম এ ই থো নব ,ম্প ন্তু পযোরোম্পমটোর ম্পভন্ন হনব ।
i.Multiple functions with the samename.
ii.differentparameters.
Example :
void sum(int a,intb)
{
int sum =a+b;
cout<<sum<<endl;
}
void(int a,intb,int c)
{
int sum = a+b+c;
cout<<sum<<endl;
}
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Recursion
Recursion is a processwhere a function can call itself.
Recursion হনিো এমন এ টি process কমিোনন এ টি ফোংেন ম্পননজন ই ম্পননজন call নর ।
2 important poits in case of recursion :
▪ RecursionCall.
▪ Base case.
Example:
int fact(intn)
{
//base case
if(n==1)
return 1;
else {
return n*fact(n-1)
}
fact(4)
4*fact(3)
3*fact(2)
2*fact(1)
1
if n = 4;
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
OOP(ObjectOrientedProgramming)
➢C + OOP = C++.
➢Real life object .Example : Human , device etc.
➢Object-oriented programming consist to implement real-world entities like
inheritance, hiding, polymorphism, etc in programming.
➢The main aim of OOP is to bind togetherthe data and the functions that operate on
them so that no other part of the code can access this data exceptthat function.
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Characteristics of OOP
Abstraction
Polymorphism
Encapsulation
Inheritance
Object
Class
OOP's
Concepts
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Class and Object
DB CA
003 004002001
Object
ClassStudent
Name
Roll No
SetName()
SetRollNo()
State Variable
Behavior/function
Class
Fig : Class and object
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
ClassandObject
অনন গুনিো Object এর common collection ই হনিো Class ।
Class : A class is a template from which individual object can be created.
Object : Any class type variable is called object.
Declaration of classand object :
classStudent
{
private:
//data member
public :
//member function
}; Student AStudent B Student C
class
Object of Studentclass
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Constructor
Constructor is a specialtype of function that is used to initialized
the object.
Constructor হনিো কস্পেোি টোইপঅব ফোংেন,মোরসোহোনময objectক initialized রো মোয় । অথদোৎobjectএর
মোন set নরকর্ওয়ো মোয় ।
Propertiesof constructor :
➢ Constructor is a specialtype of function.
➢ Constructor has the samenameas that of the class it belongs.
➢ It has no return type not even void.
➢ It's called automatically.
Typesof constructor
Defaultconstructor
Parameterizedconstructor
▪ Without parameter ▪ With parameter
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Destructor
Destructor হসলো এমন একটি ফোিংিন যো Automatically create হসব ,যখন প্কোন একটি object delete বো
destroyed করসব ।
এ টি কেোগ্রোনম এ টি মোত্র Destructor বযবহোর করো যোয় ।
Destructor এর মসধয প্কোন parameter বযবহোর করোর রসয়োেন পসে নো ।
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Access Specifiers in C++
ক োন এ টি Class এর Member ক অথদোৎ Variableঅথবো function ক বোইনর কথন Access রো মোনব ম্প মোনব নো
কসটো ম্পনভদ র রনব AccessSpecifiers এর উপর ।
In C++, there are three access specifiers:
o public - members are accessible from outside the class
o private - members cannot be accessed (or viewed) from outside the class
o protected - members cannot be accessed from outside the class, however, they
can be accessed in inherited classes. You will learn more about Inheritance later.
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Syntax of Access specifiers
class Test
{
public:
int roll;
void display()
{
-----------------
-----------------
}
private:
string name;
protected:
float cgpa;
};
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Encapsulation
Encapsulation is a processof combining variables and functions in a string unit(class).
Encapsulation িব্দটি এসেসছ capsul প্র্সক । capsul প্যমন অসনকগুসলো উপোদোন মনসয় গঠিত,প্তমমন Encapsulation হসলো এমন একটি
রসেে প্যখোসন variables এবিং functions প্ক একেোসর্ কসর একটি class এ রোখো হয় ।
Click to addtext
Encapsulations
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
this keyword
➢ Class variable এবং local variable এর মম্পর্ এ ই নোম হনয় মোয়,তোহনি Class variable ক বুঝোননোর জনয this
keyword বযবহোর রো হয় ।
➢ এন (this->) দ্বোরো ে োে রো হয় ।
Example :
classstudent{
public:
string name;
Student(string name)
{
this->name=name ;
}
void display(){
cout<<name<<endl;
}
};
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Inheritance
The process of obtaining the datamembersandfunctions fromone class to anotherclass is knownas
inheritance.
ক োন এ টি class এর তবম্পেি অনয এ টি class এ ম্পননয় মোওয়োন বিো হয় Inheritance।
কম Class ক inherit রো হয়
কম Class টো inherit নর
Parent class/
Base class/
Super class/
Mother class
Child class/
Derived class/
Sub class/
Daughter class
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
class person{
public :
stringname;
int age;
void display1(){
cout<<"Name : "<<name<<endl;
cout<<"Age: "<<age<<endl;
}
};
class student{
public :
stringname;
int age;
int id;
void display2(){
cout<<"Name : "<<name<<endl;
cout<<"Age: "<<age<<endl;
cout<<"Id: "<<id<<endl;
}
};
class person : public person{
public :
int id ;
//stringname;
//int age;
//void display1()
void display2(){
cout<<"Id : "<<id<<endl;
}
};
If studentclassinherit theperson class
Inheritance Example
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Importanceof inheritance
➢Code Resuability.
➢Application development time is less.
➢Application take less memory.
➢Inheritance makes the application code more flexible to change.
➢The program structure is short and concise which is more reliable.
➢It improves the program structure which can be readable.
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Types of Inheritance
Thereare5 types of inheritance:
i. Single inheritance
ii. Multilevelinheritance
iii. Hierarchicalinheritance
iv. Multiple inheritance
v. Hybride inheritance
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Single inheritance
In this shortof inheritance,onesubclass inheritsfromonesuperclass.
এ মোত্র Superclass ক মম্পর্ এ টি মোত্র sub class inherit নর , তোন Single inheritanceবনি।
classA
{
----------
----------
};
classB: public A
{
----------------
----------------
}
A
B
Super Class
Sub Class
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Multilevelinheritance
In this shortof inheritance,thesuperclass foroneis the subclass foranother.
কমিোননএন রঅম্পধ super clas ও subclass থো নব,এবংএ টি আনর টিন inherit রনবতোন Multilevelinheritance
বসল।
class A
{
----------
----------
};
class B: public A
{
----------------
----------------
};
class C: public B
{
----------------
----------------
};
A
B
C
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Hierarchicalinheritance
In shortof inheritance, multiple sub class derived fromsingle super class
মম্পর্ এ টি superclass ক অনন গুনিোsub class inherit নর, তোন Hierarchicalinheritanceবনি।
class A
{
----------
----------
};
class B: public A
{
----------------
----------------
};
class C: public A
{
----------------
----------------
};
A
B C D
Super Class
Sub Class
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Multiple inheritance
In shortmultiple inheritance, A class can inheritmorethanoneclass.
➢ ক োনclass এন র অম্পধ class ক inherit রনি,তোন Multipleinheritance বনি।
➢ এ টি single class এর এ োম্পধ Parentclass থো ো ।
ClassA
SuperClass
ClassB
ClassC
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Hybrid Inheritance
Hybrid inheritanceis a combination of more than one type of inheritance.
➢ এন র অম্পধ inheritance ম্পমম্পিত হনয়কম inheritance ততম্পরহয়, তোন Hybrid Inheritance বনি।
ClassA
ClassC
ClassB
ClassD
Single
inheritance
Multiple
inheritance
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Function Overloading vs Function Overriding
➢ Parameterম্পভন্নম্পভন্ন থো নব ।
➢ Overloading একই class এর মসধয হয় ।
➢ Inheritanceএর রসয়োেন হয় নো ।
➢ একটি ফোিংিনঅনয ফোিংিনসকhide কসর নো ।
➢ Checked at compile time .
➢ Parameterএ ই থো নব ।
➢ এসকর অমধক class,অর্থ াোৎএকটি superclass এবিং
sub class এর মসধয হয় ।
➢ Inheritanceএর রসয়োেন হয়।
➢ একটি ফোিংিনঅনয ফোিংিনসকhide কসর ।
➢ Checked at run time.
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Polymorphism
Polymorphism= Poly + morphism(2 Greekword).
Many Forms
প্কোন একটি মেমনসের মভন্ন মভন্ন রূপসক Polymorphism বসল ।
Polymorphism
Compile time Polymorphism Run time polymorphism
(Static or early binding) (Dynamic or late binging)
Exam : function overloading
Exam : function overriding
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Abstraction
Abstraction is the process of hidingthe implementation details andshowingonly the
functionalityto the user.
Abstractionহনিো এমন এ টি েনসস কমটো implementation details টো hide নর শুধুমোত্র functionality
টো user ক কর্িোনব ।
কমোযো থো,Abstruction হনিো এমন এ টি ম্পজম্পনস কমটো অভযন্তরীর্ ম্পজম্পনস user ক কর্িোনব নো,কসটো hide নর রোিনব।ম্প ন্তু বোইনরর
ম্পজম্পনসগুনিো user Access রনত পোরনব ।
Example : ATM,Message send,Calletc.
Properties of Abstracclass:
➢ Object Can'nt be created.
Exm : Mobile user m;
➢ We can create pointer andreferenceof base abstractclasspoints.
Exam : Mobile user *m;
➢ It can have Constructor.
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Function Template
ম্পভন্ন ম্পভন্ন datatypeএর জনয ম্পভন্ন ম্পভন্ন ফোংেন ততম্পর নো নর এমন এ টি ফোংেন ততম্পর রো মোর মনধয সব ধরনর্র datatype োজ রনব ।
অথদোৎ এমন এ টি ফোংেন ততম্পর রো মো int,float ম্প ংবো double type এর কম ক োন datatype এর জনয োজ রনব ।
template<class myTemplate>
myTemplate add(myTemplatea,myTemplateb)
{
returna+b;
}
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
ExceptionHandling
▪ Exception is a run time Error.
▪ Exception handlingis a machanismthatcan handletheexception.
Error
Compiletimeerror Run time error
Programরোন করোর পূসবথ । Programরোন করোর েময় বো চলোকোলীন েম য় ।
There are three Keyword in ExceptionHandling :
➢ Try
➢ Catch
➢ Throw
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Try,Catch,throw
try catch throw
A try block identifies a block
of code for which particular
exceptionswill be activated.
It's followed by one or more
catch blocks.
catch− A programcatchesan
exceptionwith an exception
handlerat theplace in a program
where you wantto handlethe
problem. The catchkeyword
indicates the catchingof an
exception.
throw − Aprogramthrowsan
exceptionwhen a problem
shows up. This is done using
a throw keyword.
try {
// protectedcode
} catch( ExceptionNamee )
{
// code to handleExceptionName
exception
}
try {
// protectedcode
} catch( ExceptionNamee )
{
// code to
handleExceptionNameexc
eption
}
double division(int a, int b) {
if( b == 0 )
{
throw "Division by zero
condition!";
}
return (a/b);
}
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)
Join with me
Fbpage: https://www.facebook.com/jajsofttech
Fbgroup: https://www.facebook.com/groups/2704079586349093
YouTube:https://www.youtube.com/c/JubairAhmedJunjun/videos?view_as=subscriber
LinkedIn : https://www.linkedin.com/in/jubair-ahmed-junjun-4ab6a0177/
Providedby :Jubair AhmedJunjun
B.Sc inComputer Science&Engineering(CSE)

More Related Content

What's hot

固有表現抽出について
固有表現抽出について固有表現抽出について
固有表現抽出についてSyo Kyojin
 
第五回統計学勉強会@東大駒場
第五回統計学勉強会@東大駒場第五回統計学勉強会@東大駒場
第五回統計学勉強会@東大駒場Daisuke Yoneoka
 
Stan勉強会資料(前編)
Stan勉強会資料(前編) Stan勉強会資料(前編)
Stan勉強会資料(前編) daiki hojo
 
負の二項分布について
負の二項分布について負の二項分布について
負の二項分布についてHiroshi Shimizu
 
pymcとpystanでベイズ推定してみた話
pymcとpystanでベイズ推定してみた話pymcとpystanでベイズ推定してみた話
pymcとpystanでベイズ推定してみた話Classi.corp
 
画像処理ライブラリ OpenCV で 出来ること・出来ないこと
画像処理ライブラリ OpenCV で 出来ること・出来ないこと画像処理ライブラリ OpenCV で 出来ること・出来ないこと
画像処理ライブラリ OpenCV で 出来ること・出来ないことNorishige Fukushima
 
ICASSP2019音声&音響論文読み会 論文紹介(認識系)
ICASSP2019音声&音響論文読み会 論文紹介(認識系)ICASSP2019音声&音響論文読み会 論文紹介(認識系)
ICASSP2019音声&音響論文読み会 論文紹介(認識系)貴史 益子
 
3次元計測とフィルタリング
3次元計測とフィルタリング3次元計測とフィルタリング
3次元計測とフィルタリングNorishige Fukushima
 
Arithmer AIチャットボット
Arithmer AIチャットボットArithmer AIチャットボット
Arithmer AIチャットボットArithmer Inc.
 
深層学習 勉強会第5回 ボルツマンマシン
深層学習 勉強会第5回 ボルツマンマシン深層学習 勉強会第5回 ボルツマンマシン
深層学習 勉強会第5回 ボルツマンマシンYuta Sugii
 
Operations research yonezawa_no2
Operations research yonezawa_no2Operations research yonezawa_no2
Operations research yonezawa_no2ssuser0bebd2
 
スペクトログラム無矛盾性に基づく独立低ランク行列分析
スペクトログラム無矛盾性に基づく独立低ランク行列分析スペクトログラム無矛盾性に基づく独立低ランク行列分析
スペクトログラム無矛盾性に基づく独立低ランク行列分析Kitamura Laboratory
 
[量子コンピューター勉強会資料] マヨラナ粒子によるスケーラブルな量子コンピューターの設計
[量子コンピューター勉強会資料] マヨラナ粒子によるスケーラブルな量子コンピューターの設計[量子コンピューター勉強会資料] マヨラナ粒子によるスケーラブルな量子コンピューターの設計
[量子コンピューター勉強会資料] マヨラナ粒子によるスケーラブルな量子コンピューターの設計Takayoshi Tanaka
 
A Brief Introduction of Anomalous Sound Detection: Recent Studies and Future...
A Brief Introduction of Anomalous Sound Detection:  Recent Studies and Future...A Brief Introduction of Anomalous Sound Detection:  Recent Studies and Future...
A Brief Introduction of Anomalous Sound Detection: Recent Studies and Future...Yuma Koizumi
 
ベイズ統計によるデータ解析
ベイズ統計によるデータ解析ベイズ統計によるデータ解析
ベイズ統計によるデータ解析Kunihiro Hisatsune
 
セグメントツリーにセグメントツリーを乗せる手法(画像付録)
セグメントツリーにセグメントツリーを乗せる手法(画像付録)セグメントツリーにセグメントツリーを乗せる手法(画像付録)
セグメントツリーにセグメントツリーを乗せる手法(画像付録)光喜 濱屋
 
[DL輪読会]YOLOv4: Optimal Speed and Accuracy of Object Detection
[DL輪読会]YOLOv4: Optimal Speed and Accuracy of Object Detection[DL輪読会]YOLOv4: Optimal Speed and Accuracy of Object Detection
[DL輪読会]YOLOv4: Optimal Speed and Accuracy of Object DetectionDeep Learning JP
 
[DL輪読会]DNN-based Source Enhancement to Increase Objective Sound Quality Asses...
[DL輪読会]DNN-based Source Enhancement to Increase Objective Sound Quality Asses...[DL輪読会]DNN-based Source Enhancement to Increase Objective Sound Quality Asses...
[DL輪読会]DNN-based Source Enhancement to Increase Objective Sound Quality Asses...Deep Learning JP
 
2014年度春学期 画像情報処理 第13回 Radon変換と投影定理 (2014. 7. 16)
2014年度春学期 画像情報処理 第13回 Radon変換と投影定理 (2014. 7. 16)2014年度春学期 画像情報処理 第13回 Radon変換と投影定理 (2014. 7. 16)
2014年度春学期 画像情報処理 第13回 Radon変換と投影定理 (2014. 7. 16)Akira Asano
 

What's hot (20)

固有表現抽出について
固有表現抽出について固有表現抽出について
固有表現抽出について
 
第五回統計学勉強会@東大駒場
第五回統計学勉強会@東大駒場第五回統計学勉強会@東大駒場
第五回統計学勉強会@東大駒場
 
Stan勉強会資料(前編)
Stan勉強会資料(前編) Stan勉強会資料(前編)
Stan勉強会資料(前編)
 
負の二項分布について
負の二項分布について負の二項分布について
負の二項分布について
 
pymcとpystanでベイズ推定してみた話
pymcとpystanでベイズ推定してみた話pymcとpystanでベイズ推定してみた話
pymcとpystanでベイズ推定してみた話
 
明日使えないすごいビット演算
明日使えないすごいビット演算明日使えないすごいビット演算
明日使えないすごいビット演算
 
画像処理ライブラリ OpenCV で 出来ること・出来ないこと
画像処理ライブラリ OpenCV で 出来ること・出来ないこと画像処理ライブラリ OpenCV で 出来ること・出来ないこと
画像処理ライブラリ OpenCV で 出来ること・出来ないこと
 
ICASSP2019音声&音響論文読み会 論文紹介(認識系)
ICASSP2019音声&音響論文読み会 論文紹介(認識系)ICASSP2019音声&音響論文読み会 論文紹介(認識系)
ICASSP2019音声&音響論文読み会 論文紹介(認識系)
 
3次元計測とフィルタリング
3次元計測とフィルタリング3次元計測とフィルタリング
3次元計測とフィルタリング
 
Arithmer AIチャットボット
Arithmer AIチャットボットArithmer AIチャットボット
Arithmer AIチャットボット
 
深層学習 勉強会第5回 ボルツマンマシン
深層学習 勉強会第5回 ボルツマンマシン深層学習 勉強会第5回 ボルツマンマシン
深層学習 勉強会第5回 ボルツマンマシン
 
Operations research yonezawa_no2
Operations research yonezawa_no2Operations research yonezawa_no2
Operations research yonezawa_no2
 
スペクトログラム無矛盾性に基づく独立低ランク行列分析
スペクトログラム無矛盾性に基づく独立低ランク行列分析スペクトログラム無矛盾性に基づく独立低ランク行列分析
スペクトログラム無矛盾性に基づく独立低ランク行列分析
 
[量子コンピューター勉強会資料] マヨラナ粒子によるスケーラブルな量子コンピューターの設計
[量子コンピューター勉強会資料] マヨラナ粒子によるスケーラブルな量子コンピューターの設計[量子コンピューター勉強会資料] マヨラナ粒子によるスケーラブルな量子コンピューターの設計
[量子コンピューター勉強会資料] マヨラナ粒子によるスケーラブルな量子コンピューターの設計
 
A Brief Introduction of Anomalous Sound Detection: Recent Studies and Future...
A Brief Introduction of Anomalous Sound Detection:  Recent Studies and Future...A Brief Introduction of Anomalous Sound Detection:  Recent Studies and Future...
A Brief Introduction of Anomalous Sound Detection: Recent Studies and Future...
 
ベイズ統計によるデータ解析
ベイズ統計によるデータ解析ベイズ統計によるデータ解析
ベイズ統計によるデータ解析
 
セグメントツリーにセグメントツリーを乗せる手法(画像付録)
セグメントツリーにセグメントツリーを乗せる手法(画像付録)セグメントツリーにセグメントツリーを乗せる手法(画像付録)
セグメントツリーにセグメントツリーを乗せる手法(画像付録)
 
[DL輪読会]YOLOv4: Optimal Speed and Accuracy of Object Detection
[DL輪読会]YOLOv4: Optimal Speed and Accuracy of Object Detection[DL輪読会]YOLOv4: Optimal Speed and Accuracy of Object Detection
[DL輪読会]YOLOv4: Optimal Speed and Accuracy of Object Detection
 
[DL輪読会]DNN-based Source Enhancement to Increase Objective Sound Quality Asses...
[DL輪読会]DNN-based Source Enhancement to Increase Objective Sound Quality Asses...[DL輪読会]DNN-based Source Enhancement to Increase Objective Sound Quality Asses...
[DL輪読会]DNN-based Source Enhancement to Increase Objective Sound Quality Asses...
 
2014年度春学期 画像情報処理 第13回 Radon変換と投影定理 (2014. 7. 16)
2014年度春学期 画像情報処理 第13回 Radon変換と投影定理 (2014. 7. 16)2014年度春学期 画像情報処理 第13回 Radon変換と投影定理 (2014. 7. 16)
2014年度春学期 画像情報処理 第13回 Radon変換と投影定理 (2014. 7. 16)
 

Similar to C++ Bangla Tutorials.

Basic C programming language in Bangla.
Basic C programming language in Bangla.Basic C programming language in Bangla.
Basic C programming language in Bangla.Jubair Ahmed Junjun
 
Extended bangla first_chapter_computer_and_history_of_computer_short
Extended bangla first_chapter_computer_and_history_of_computer_shortExtended bangla first_chapter_computer_and_history_of_computer_short
Extended bangla first_chapter_computer_and_history_of_computer_shortSayed Ahmed
 
3rd presentation slide_our_videos_related_to_grade_9_and_10
3rd presentation slide_our_videos_related_to_grade_9_and_103rd presentation slide_our_videos_related_to_grade_9_and_10
3rd presentation slide_our_videos_related_to_grade_9_and_10Sayed Ahmed
 
Class six ict 02 8
Class six ict 02 8Class six ict 02 8
Class six ict 02 8Cambriannews
 
English first chapter_computer_and_history_of_computer_short
English first chapter_computer_and_history_of_computer_shortEnglish first chapter_computer_and_history_of_computer_short
English first chapter_computer_and_history_of_computer_shortSayed Ahmed
 
প্রোগ্রামিং ভাষা (পঞ্চম অধ্যায়) Hsc C Programming-by a. z. m. jalal uddin joy...
প্রোগ্রামিং ভাষা (পঞ্চম অধ্যায়) Hsc C Programming-by a. z. m. jalal uddin joy...প্রোগ্রামিং ভাষা (পঞ্চম অধ্যায়) Hsc C Programming-by a. z. m. jalal uddin joy...
প্রোগ্রামিং ভাষা (পঞ্চম অধ্যায়) Hsc C Programming-by a. z. m. jalal uddin joy...A. Z. M. JALAL UDDIN JOY
 
Computer tips M Hasan
Computer tips M HasanComputer tips M Hasan
Computer tips M HasanJoybonna
 

Similar to C++ Bangla Tutorials. (8)

Basic C programming language in Bangla.
Basic C programming language in Bangla.Basic C programming language in Bangla.
Basic C programming language in Bangla.
 
Extended bangla first_chapter_computer_and_history_of_computer_short
Extended bangla first_chapter_computer_and_history_of_computer_shortExtended bangla first_chapter_computer_and_history_of_computer_short
Extended bangla first_chapter_computer_and_history_of_computer_short
 
3rd presentation slide_our_videos_related_to_grade_9_and_10
3rd presentation slide_our_videos_related_to_grade_9_and_103rd presentation slide_our_videos_related_to_grade_9_and_10
3rd presentation slide_our_videos_related_to_grade_9_and_10
 
Class six ict 02 8
Class six ict 02 8Class six ict 02 8
Class six ict 02 8
 
English first chapter_computer_and_history_of_computer_short
English first chapter_computer_and_history_of_computer_shortEnglish first chapter_computer_and_history_of_computer_short
English first chapter_computer_and_history_of_computer_short
 
প্রোগ্রামিং ভাষা (পঞ্চম অধ্যায়) Hsc C Programming-by a. z. m. jalal uddin joy...
প্রোগ্রামিং ভাষা (পঞ্চম অধ্যায়) Hsc C Programming-by a. z. m. jalal uddin joy...প্রোগ্রামিং ভাষা (পঞ্চম অধ্যায়) Hsc C Programming-by a. z. m. jalal uddin joy...
প্রোগ্রামিং ভাষা (পঞ্চম অধ্যায়) Hsc C Programming-by a. z. m. jalal uddin joy...
 
Computer tips M Hasan
Computer tips M HasanComputer tips M Hasan
Computer tips M Hasan
 
Computer level 1
Computer level 1Computer level 1
Computer level 1
 

More from Jubair Ahmed Junjun

Visual studio code keyboard shortcut
Visual studio code keyboard shortcutVisual studio code keyboard shortcut
Visual studio code keyboard shortcutJubair Ahmed Junjun
 
Microsoft word2016 keyboard shortcut
Microsoft word2016 keyboard shortcutMicrosoft word2016 keyboard shortcut
Microsoft word2016 keyboard shortcutJubair Ahmed Junjun
 
Microsoft word2013 keyboard shortcut
Microsoft word2013 keyboard shortcutMicrosoft word2013 keyboard shortcut
Microsoft word2013 keyboard shortcutJubair Ahmed Junjun
 
Microsoft word 2010 keyboard shortcut
Microsoft word 2010 keyboard shortcutMicrosoft word 2010 keyboard shortcut
Microsoft word 2010 keyboard shortcutJubair Ahmed Junjun
 
Shortcuts for git lab web application
Shortcuts for git lab web applicationShortcuts for git lab web application
Shortcuts for git lab web applicationJubair Ahmed Junjun
 
Aobe photoshop cs5 keyboard shortcut
Aobe photoshop cs5 keyboard shortcutAobe photoshop cs5 keyboard shortcut
Aobe photoshop cs5 keyboard shortcutJubair Ahmed Junjun
 
Adobe photoshop cs4 keyboard shortcut
Adobe photoshop cs4 keyboard shortcutAdobe photoshop cs4 keyboard shortcut
Adobe photoshop cs4 keyboard shortcutJubair Ahmed Junjun
 
Adobe photoshop cc keyboard shortcut
Adobe photoshop cc keyboard shortcutAdobe photoshop cc keyboard shortcut
Adobe photoshop cc keyboard shortcutJubair Ahmed Junjun
 
Adobe illustrator cc keyboard shortcut
Adobe illustrator cc keyboard shortcutAdobe illustrator cc keyboard shortcut
Adobe illustrator cc keyboard shortcutJubair Ahmed Junjun
 
Adobe illustrator c55 keyboard shortcut.
Adobe illustrator c55 keyboard shortcut.Adobe illustrator c55 keyboard shortcut.
Adobe illustrator c55 keyboard shortcut.Jubair Ahmed Junjun
 

More from Jubair Ahmed Junjun (20)

Visual studio code keyboard shortcut
Visual studio code keyboard shortcutVisual studio code keyboard shortcut
Visual studio code keyboard shortcut
 
Sublimetext keyboard shortcut
Sublimetext keyboard shortcutSublimetext keyboard shortcut
Sublimetext keyboard shortcut
 
Notepad++ keyboard shortcut
Notepad++ keyboard shortcutNotepad++ keyboard shortcut
Notepad++ keyboard shortcut
 
Netbeans keyboard shortcut
Netbeans keyboard shortcutNetbeans keyboard shortcut
Netbeans keyboard shortcut
 
Microsoft word2016 keyboard shortcut
Microsoft word2016 keyboard shortcutMicrosoft word2016 keyboard shortcut
Microsoft word2016 keyboard shortcut
 
Microsoft word2013 keyboard shortcut
Microsoft word2013 keyboard shortcutMicrosoft word2013 keyboard shortcut
Microsoft word2013 keyboard shortcut
 
Microsoft word 2010 keyboard shortcut
Microsoft word 2010 keyboard shortcutMicrosoft word 2010 keyboard shortcut
Microsoft word 2010 keyboard shortcut
 
Microsoft word 2007
Microsoft word 2007Microsoft word 2007
Microsoft word 2007
 
Shortcuts for git lab web application
Shortcuts for git lab web applicationShortcuts for git lab web application
Shortcuts for git lab web application
 
Excel 2016 keyboard shortcut
Excel 2016 keyboard shortcutExcel 2016 keyboard shortcut
Excel 2016 keyboard shortcut
 
Excel 2013 keyboard shortcut
Excel 2013 keyboard shortcutExcel 2013 keyboard shortcut
Excel 2013 keyboard shortcut
 
Excel 2010 keyboard shortcut
Excel 2010 keyboard shortcutExcel 2010 keyboard shortcut
Excel 2010 keyboard shortcut
 
Excel 2007 keyboard shortcut
Excel 2007 keyboard shortcutExcel 2007 keyboard shortcut
Excel 2007 keyboard shortcut
 
Aobe photoshop cs5 keyboard shortcut
Aobe photoshop cs5 keyboard shortcutAobe photoshop cs5 keyboard shortcut
Aobe photoshop cs5 keyboard shortcut
 
Adobe photoshop cs4 keyboard shortcut
Adobe photoshop cs4 keyboard shortcutAdobe photoshop cs4 keyboard shortcut
Adobe photoshop cs4 keyboard shortcut
 
Adobe photoshop cc keyboard shortcut
Adobe photoshop cc keyboard shortcutAdobe photoshop cc keyboard shortcut
Adobe photoshop cc keyboard shortcut
 
Adobe illustrator cc keyboard shortcut
Adobe illustrator cc keyboard shortcutAdobe illustrator cc keyboard shortcut
Adobe illustrator cc keyboard shortcut
 
Adobe illustrator c55 keyboard shortcut.
Adobe illustrator c55 keyboard shortcut.Adobe illustrator c55 keyboard shortcut.
Adobe illustrator c55 keyboard shortcut.
 
Modulation in telecommunication
Modulation in telecommunicationModulation in telecommunication
Modulation in telecommunication
 
Java script
Java scriptJava script
Java script
 

C++ Bangla Tutorials.

  • 1. Jubair Ahmed Junjun B.Sc in Computer Science & Engineering(CSE)C++Lecture. https://www.youtube.com/c/JubairAhmedJunjun/videos?view_as=subscriberYouTube :
  • 2. C++ • C++ is Known to be a very powerful Computer programming language. • C++ is a general purpose,case sensitive,OOP(Object oriented programming language). Uses of C++ • It's use to developed game engines,games and desktop apps,art applications,music players etc. • C++ is being highly used to write device drivers and other software. Jubair Ahmed Junjun B.Sc in Computer Science & Engineering(CSE)
  • 3. History of C++ • C++ programming language was developed in 1980 by Bjarne Stroustrup at bell laboratories of AT • Bjarne Stroustrup is known as the founder of C++. • C++ was derived from c,and is largely based on it. • 4th most used language
  • 4. Overlap of C,C++ and Java Jubair Ahmed Junjun B.Sc in Computer Science & Engineering(CSE) C++ C Java
  • 5. Feature of C++ • Simple • Mid Level Programming Language. • Rich - Library • Memory management. • Fast speed. • Pointers. • Recursion • OOP(Object oriented programming). • Compiler based. Jubair Ahmed Junjun B.Sc in Computer Science & Engineering(CSE)
  • 6. প্রোগ্রোম :ক োনএ টি সমসযো সমোধোননর জনয ম্পিউটোনরর ভোষোয়(0,1) ম্পিম্পিত ম্পনর্দ নের সমম্পিন কেগ্রোমবনি। প্রোগ্রোমমিং ভোষো : কেোগ্রোমরচনোর জনয ম্পবম্পভন্ন (েব্দ,বর্দ,অং ,সংন ত) এবং এগুনিো ম্পবনযোনসর ম্পনয়মম্পমম্পিনয় ততম্পর রোহয় কেোগ্রোম্পমংভোষো।নমমন: C,C++,Java,Assemblylanguageetc. প্রোগ্রোম(P R O G R A M ) ও প্রোগ্রোমমিং ভোষো(P R O G R A M M I N G L A N G U A G E ) Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 7. 1.Source code and Object code 2.What is Translator? 3.Types of Translator 4.How to Translator work(assembler,compiler,interpret er) TOPIC : TRANSLATOR (অনু বোদক প্রোগ্রোম) Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 8. Soursecode &ObjectCode SOURCECODE উচ্চতর ভোষোয় ম্পিম্পিত কেোগ্রোমন ই কসোসদ ক োড (source code) বনি। OBJECT CODE কমম্পেন ভোষোয় ম্পিম্পিত ক োডন object code বিো হয়। Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 9. TRANSLATOR (অনুবোর্ কেোগ্রোম) কম কেোগ্রোম কসোসদ ক োড (source code) ক object code এ পম্পরর্ত নর,তোন TRANSLATOR(অনুবোর্ কেোগ্রোম) বনি। Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 10. Assembler(অযোসেম্বলোর) কম অনুবোর্ কেোগ্রোম অযোসেম্বমল ভোষোয় ম্পিম্পিত কেোগ্রোমন কমম্পেন ভোষোয় রূপোন্তর নর,তোন ই Assembler(অযোসেম্বলোর) বনি। সুম্পবধো : ➢ কননমোম্পন ক োডন কমম্পেন ভোষোয় পম্পরর্ত নর। ➢ কেোগ্রোনম ভূ ি থো নি ErrorMessage ের্েদন নর। ➢ কেোগ্রোনমর ভূ ি সংনেোধন রো সহজ। ➢ ম্পডবোম্প ং এবং কটম্পটং এর োজ সংনেোধন রো সহজ। ➢ কমনমোম্পরনত ম জোয় ো কনয়। Assembly language program Assembler Machine Language অসুম্পবধো : ➢ কেোগ্রোম ম্পনবদোহ রোর জনয সময় কবম্পে েনয়োজন হয়। ➢ িোইিোনরর তু িনোয় (5-25)গুন সময় কবম্পে কনয়। Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 11. Compiler(কম্পোইলোর)andInterpreter(ইন্টোরসরটোর) COMPILER( িোইিোর) সিূর্দ কেোগ্রোমন এ সোনথ অনুবোর্ নর। কম সব কেোগ্রোম্পমং ভোষোন িোইি রো হয় : -- C,C++,object- c,C#,Pascal,COBOL,ADA,Visual Basic,Smalltalk etc. INTERPRETER(ইন্টোরনেটোর) সিূর্দ কেোগ্রোমন এ িোইন এ িোইন নর অনুবোর্ নর। কমসব কেোগ্রোম্পমং ভোষোন ইন্টোরনেটোর রো হয় : Basic,php,python,Perl,Ruby,javascript etc. Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 12. কোসেরধোপেমূহ COMPILER(কম্পোইলোর) INTERPRETER(ইন্টোরসরটোর) Source code Compiler List of error Object code 1st Step : 2nd Step : Input Object code Output Source code Interpreter Output Input Total program translate at a timethen execute Line by line translate then execute Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 13. কম্পোইলোরএবিং ইন্টোরসরটোসরর মসধযপোর্থকয কম্পোইলোর ইন্টোরসরটোর ➢ সিূর্দ কেোগ্রোমন এ সোনথ অনুবোর্ নর। ➢ কেোগ্রোনমর সব ভূ ি এ সোনথ ের্েদন নর । ➢ িোইিোর দ্রুত োজ নর। ➢ এ বোর কেোগ্রোম িোইি রোর পর পরবতী িোইি রনত হয় নো। ➢ বড় ধরননর ম্পিউটোনর কবম্পে বযবহোর হয়। ➢ এ িোইন এ িোইন নর অনুবোর্ নর। ➢ এ িোইন নর ভূ ি ের্েদন নর। ➢ ধীনর োজ রো। ➢ েম্পতটি োনজর পূনবর্ অনুবোর্ রোর েনয়োজন হয়। ➢ মোইনরো ম্পিউটোনর কবম্পে বযবহোর রো হয়। Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 14. অযোি ম্পরর্ম(Algorithm) কম পদ্ধম্পতনত ক োন এ টি সমসযোন ধোনপ ধোনপ সমোধোন রো হয়,তোন অযোলগমরদম(Algorithm) বনি । কমমন : ম্পতনটি সংিযোর কমো ফি ম্পনর্দয় রোর অযোি ম্পরর্ম(Algorithm) । Step-1: Start Step-2: Read/Input Step-3: Summation of Three numbers. Step-4: Print/Output Step-5: End Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 15. অযোলগমরদম(Algorithm) প্লখোর মনয়ম /ববমিষ্ট এবিংেুমবধো ম্পনয়ম/তবম্পেি : ➢ সহজনবোধয হনত হনব। ➢ েনতয টি ধোপ স্পি হনত হনব,মোনত কম ক োন কেোগ্রোমোর সহনজ বুঝনত পোনর। ➢ ধোনপ ধোনপ সমসযোর সমোধোন রনত হনব। ➢ বযোপ ভোনব েনয়ো রোর উপনমো ী হনত হনব। সুম্পবধো : ➢ কেোগ্রোনমর উনযযেয সহনজ বুঝনত পোনর। ➢ ভূ ি ম্পনর্দনয় সোহোনময নর। ➢ কেোগ্রোম পম্পরবতদ ন ও পম্পরবধদনন সোহোময নর। Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 16. প্লোচোটথ (Flowchart) কম পদ্ধম্পতনত ক োন কেোগ্রোমন ম্পচত্র বো েম্পতন র মোধযনম ে োে রো হয়।তোন কলোচোটদ বনি। প্লোচোটথ ➢ System এ কডটোর েবোহ েম্পরয়ো রর্,সংরক্ষর্ ও ফিোফি ের্েদননর ম্পর্ ম্পচম্পিতহয়,তোন System Flowchartবনি। ➢ কেোগ্রোম রচনোর সময় কম Flowchartততম্পর রো হয়,তোন Program Flowchartবনি। System Flowchart Program Flowchart Provided by : Jubair Ahmed Junjun B.Sc in Computer Science & Engineering(CSE)
  • 17. Basic Flowchart symbolsand meaning রতীক(Symbol) অর্থ(Meaning) End , Start Process Decision Flowline Connector Input/output Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 18. Special Symbolsof Flowchart Mult-Document Preparation Storageof finished goods Logical OR Delay ManualOperation DataStored Database Predefinedprocess Alternateprocess Document Manualinput Materialhandling Storageof raw materials Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 19. সমসযো : ম্পতনটিসংিযোরকমো ফিম্পনর্দয় রোর কলোচোটদ (Flowchart) ম্পিি। Start Input a,b,c Sum = a+b+c End Output sum Step-1 : Start Step-2 : Read/Input Step-3 : Summationof Three numbers. Step-4 : Print/Output Step-5 : End Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 20. অযোি ম্পরর্ম(Algorithm) ওকলোচোটদ (Flowchart) এর মনধয পোথ য অযোলগমরদম(ALGORITHM) প্লোচোটথ (FLOWCHART) ➢ধোনপ ধোনপ সমোধোন নর। ➢বর্দনো ম্পনভদ র। ➢বুঝনত সময় কবম্পে িোন । ➢কেোগ্রোম েবোনহর ম্পর্ সহনজ বুঝো মোয় নো। ➢কেোগ্রোনমর ভূ ি দূর রো ঠিন। ➢ সোংন ম্পত ম্পচি বো েতীন ন রমোধযনমসমসযো সমোধোন রোন কলোচোটদ বনি। ➢ ম্পচত্র ম্পনভদ র। ➢ বুঝনত তু িনোমূি সময় মিোন । ➢ সহনজবুঝো মোয়। ➢ কেোগ্রোনমরভূ িদুর রো সহজ। Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 21. সুনডোন োড(Pseudo code) সুনডো(Pseudo) ম্পগ্র েব্দ।অথদ ছদ্ম বো ৃ ম্পত্রম। কর্িনত কেোগ্রোম্পমং ক োড এর মত মনন হনিও এটি ম্প ন্তু ক োন কেোগ্রোম্পমং ক োড নয়।এটি হনিো মুিত ক োড রোর পূনবদ এ টি রোফ বো িসড়ো কটক্সট ভোসদন ততম্পর রোর েম্পরয়ো। কমমন : ম্পতনটি সংিযোর কমো ফি ম্পনর্দয় রোর সুনডোন োড ম্পিি। Input A Input B Input C Total = A+ B+ C Print Total Stop Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 22. কেোগ্রোমততম্পররধোপসমূহ কেোগ্রোনমর সোহোনময ক োন সমসযো সমোধোন রনত হনি তগুনিো ধোপ অনুসরন রনত হয়,আর এই ধোপসমূহন ই কেোগ্রোম ততম্পরর ধোপ বিো হয়। েমেযো মনমদথ ষ্টকরণ েমেযো মবসেষণ প্রোগ্রোম মিেোইন প্রোগ্রোম উন্নয়ন প্রোগ্রোম বোস্তবোয়ন প্রোগ্রোম রক্ষণোসবক্ষণ ✓সমসযোম্পচম্পিত রর্ ✓সমসযোসিন দ তথযসংগ্রহ ✓ ইনপুটআউটপুটসনোক্ত ✓ ম্পিউটোনররকমনমোম্পর ম্পনধদোরর্ ✓অযোি ম্পরর্ম ✓কলোচোটদ ✓কেোগ্রোম ক োম্পডং। ✓Algorithm,flowchart ,Pseudo code কথন কেোগ্রোম্পমং ভোষোয় কেোগ্রোম ম্পিিনত হনব। ✓কটম্পটং ✓ম্পডবোম্প ং ✓র্ীর্দনময়োর্ী বযবহোরম্পনম্পিত রর্। ✓হোডদ ওয়োর ,সফ্টওয়োর ওডকুইনমন্ট রক্ষর্োনবক্ষর্। ✓ োমদ োম্পরতো ভীরভোনব পমদনবক্ষর্। Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 23. ম্পডবোম্প ং(Debugging)and Error বো েনব্দর অথদ ভূ ি।নেোগ্রোনমর ভূ িগুনিোন বো বিো হয়। আর কেোগ্রোনম ক োন ভূ ি পোওয়ো ক নি তো সংনেোধন রোন বিো হয় ম্পডবোম্প ং। Syntax error (বযো রর্ তভূ ি) Logical error(মুম্পক্তসম্মত ভূ ি) Runtime error(তথয তভূ ি) ➢Types of Error Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE) ➢Error : Any Unexpected output is called error.
  • 24. C++Programএবিং এর মবমভন্ন অিংি । #include<iostream> using namespace std; int main() { cout<<"Hello World"; return 0; } Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE) Input output stream.এটিএ টি কহডোর ফোইি#include এর সোহোনময এটিন কেোগ্রোনম সংমুক্ত রো হয়। রসতযক প্রোগ্রোমমিং লযোঙ্গুসয়সের মকছু লোইসেমর ফোিংিনআসছ । প্তমমন মে++এরও আসছ । স্ট্যোন্ডোিথ মে ++লোইসেরীসতেমস্ত উপোদোনগুমল র কোিকরো আসছ , যোসক namespace stdবলো হয়। লোইসেমর ফোিংিন এররসতযকটি উপোদোনগুমলর বযবহোর প্যোগযতো অেথ ন করোর েনযই usingnamespace std;বযবহোরকরো হয়। int একটি keyword ।কম্পোইলএবিং মনর্ বোসহর েময় মে/মে++ এ main() ফোিংিন প্র্সক শুরু হয় ।তোই প্রোগ্রোসম এ ফোিংিনঅবিযই মলখসত হসব । cout<<হসে Standardoutputstream. এটি দ্বোরো মমনটসর প্কোন মকছু রদিথন করো হয় ।Keyword,Returning 0 means a successfultermination.
  • 25. Escapesequence/Backslashcharacter C++ কেোগ্রোনম ম্প ছু Backslash character বযোবোম্প র রো হয় ।মো ফোংেন ম্পহনসনব োজ নর । Character Escape Sequence Meaning a (Alert)Bell b Backspace f Form feed n Newline r Carriagereturn t HorizontalTab v Verticaltab o Null character ' Single quote " Double quote Backslash ? Question mark. Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 26. Comment Comment হনিো কসোসদ ক োড ম্পিিোর সময় ম্পননজর বো অনযজননর জনয এ টি কনোড ততম্পর রো । Comment বযবহোর এর উসেিয : ➢ কেোগ্রোনমর উনযেয সহনজ বুঝোননোর জনয । ➢কেোগ্রোম সিন র্ বর্দনো ম্পিনি রোিোর জনয । ➢কেোগ্রোনম ক োন িোইন ম্প বুঝোয় তো বুঝোর জনয । Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 27. Comment এর রকোর i.Single line comment : ➢ কেোগ্রোনমর কমক োন জোয় োয় বযবহোর রো মোয় । ➢ // ম্পর্নয় শুরু রনত হয় । ➢ // ম্পর্নয় ম্প ছু শুরু রনি িোইিোর তো এম্পড়নয় মোয়। Example : #include<iostream> usingnamespace std; int main() { //printing hello world. cout<<"Hello World"; return 0; } Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 28. ii.Multiplelinecomment: Ø প্রোগ্রোসমর প্য প্কোন েোয়গোয় বযবহোর করো যোয় । Ø শুরু হয় /* মদসয়,প্িষ হয় */ মদসয় । Example: /* ------------------ It's multiplelinecomment. ------------------ */ Provided by: JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 29. কটোন ন(Token) A token is the smallest element of a program that is meaningful to the compiler. Types of Token ✓ Keywords : int,float,while ✓ Identifiers : sum,main ✓ Constants : 100,555 ✓ Strings : “JAJSoftTech” ✓ Special Symbols : [] () {}, ; * = # ✓ Operators : +,-,*,/,% Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 30. asm continoue float new signed try auto default for operator sizeof union break delete friend private static unsigned case do go to protected struct virtual catch double if public switch void char else inline register template typedef class enum int return this volatile const extern long short throw while Keywordহনিো এমন ম্প ছু সংরম্পক্ষতেব্দ,মোএ টি ম্পনম্পর্দ িঅথদ বহর্ রনবএবং কেোগ্রোনম এ টি ম্পনম্পর্দ ি োমদ সিোর্ন রনব। মে++ প্রোগ্রোমমিং এ Keyword েমূহ : Keyword Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 31. Keyword বযবহোনরনর ম্পনয়ম ➢Keyword িননো variable বো চিন র নোম ম্পহনসনব বযবহোর রো হয় নো। ➢Keyword সমূনহর েম্পতটি বর্দ small letterএর হয়। ➢মম্পর্ িননো দুটি keyword এ সোনথ বযবহোর রনত হয়,তোহনি মোঝিোনন ফো োাঁ স্থোন থো নত হনব। ➢keyword সমূনহর নোম এ টি এ েব্দ,অথদোৎ মোনঝ ক োন ফোাঁ ো স্থোন থোন নো। Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 32. Identifier Identifiers are used as the general terminology for naming of variables, functions and arrays. Some identifiers are used: A-Z,a-z,0-9,$,_ Some valid and non-valid identifier example Valid identifiers Non-valididentifiers Number1,Int,std_name 1number,int, std name Keyword(Reservedword) Space can’tbe used Digit can not be used Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 33. Constant Constants are also like normal variables. But, only difference is, their values can notbe modified by the program once they are defined. Constants refer to fixed values. Types of Constants : ✓Integerconstants– Example: 0, 1, 1218, 12482 ✓Real or Floating point constants– Example: 0.0, 1203.03, 30486.184 ✓Octal &Hexadecimalconstants– Example: octal: (013)8 = (11)10,Hexadecimal:(013)16= (19)10 ✓Characterconstants-Example: ‘a’,‘A’, ‘z’ Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 34. String&SpecialSymbols In C, a string is a sequence of characters. chargreeting[6]= {'H', 'e', 'l', 'l', 'o', '0'}; chargreeting[]= "Hello"; Special Symbols :The following special symbols are used in C having some special meaning and thus, cannot be used for some other purpose.[] () {}, ; * = # Brackets[]: Openingandclosing bracketsareused as arrayelement reference.These indicatesingle and multidimensionalsubscripts. Parentheses():These special symbols areused to indicatefunction calls andfunction parameters. Braces{}: These openingandendingcurly braces marksthestartandendofa block of code containingmorethanone executable statement. comma (, ): Itis used to separatemorethanonestatements like forseparating parametersinfunction calls. semi colon : It is anoperatorthatessentially invokes something called aninitialization list. asterisk(*): It is used to create pointervariable. Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 35. Variable/ চলক কেোগ্রোনম ক োনএ টি নোম ম্পর্নয় মম্পর্ তোরমনধয data রোিো হয়,তনবঐ নোমটিন চি বনি। কমমন : number 1 =10; Name= "JAJSoftTech" Variable ম্পিিোর ম্পনয়ম : 1.Variableএর নোম বর্দ (A-Z,a-z).অঙ্ক(0,1....9),আন্ডোরনকোর(_)এবং ডিোর ম্পচি ($)বযবহোর রো হয়। Valid Invalid first_name "JAJ SoftTech" Id1 JAJSoftTech@ Code1022 #JAJSoftTech $JAJSoftTech Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 36. 2.Variable এর নোম ম্পডম্পজট বো অঙ্ক ম্পর্নয় শুরু হনত পোনর নো। Invalid Valid 1number _number1, number, a2b 3.Keywordবো function কভম্পরনয়বনির নোম ম্পহনসনব বযবহোর রো মোয় নো। Valid Invalid Main main Float float for 4. Variable এর নোনমর মোনঝ ক োন ফোাঁ ো স্থোন থোন নো। Invalid Valid First number first_number Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 37. Operator C++ ভোষোয় োম্পর্ম্পত এবং কমৌম্পক্ত োজ রোর জনয তগুনিো ম্পবনেষ ম্পচি (+,-*,/) বযবহোর রো হয়,এনর্রন অপোনরটর বনি। A + B = 7 Operand Expression Constand Operator Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 38. TypesofOperator ➢Arithmetic Operator ➢AssignmentOperator ➢Relational Operator ➢Logical Operator ➢Conditional Operator ➢Unary Operator ➢Bitwise operator ➢Special Operator Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 39. ArithmeticOperator Operator কোে উদোহোরণ ফলোফল + প্যোগ করো X=15+6 21 - মবসয়োগ করো X=15-6 9 * গুণ করো X=15*6 90 / ভোগ করো X=15/6 2 % ভোগসিষ X=15%6 3 Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 40. গোমণমতক ফরমুলোসক এসেসরিসনরূপোন্তর : গোমণমতক এেসরিন েমতু লয মে এেসরিন X = a2-2ab + b2 X=a*a– 2*a*b + b*b; Area =√ s(s - a)(s - b)(s - c) Area = sqrt(s*(s-a)*(s-b)*(s-c)); x = Y X ==Y; Y=AB2+C Y = A*B*B+C; Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 41. AssignmentOperator Operator Example Full meaning = X = x+5 X=x+5 += X+=5 X=x+5 -+ X-=5 X=x-5 *= X*=y X=x*y /= X/=5 X=x/5 %= X%=5 X=x%5 Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 42. RelationalOperator Operator Meaning Example Result == Equal to 5==2 False != Not equalto 5!= 2 True < Lessthan 5<2 False > Greater than 5> 2 True <= Lessthan or equal to 5<=2 False >= Greater than or equalto 5>=2 True Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 43. LogicalOperator Operator Name Example && Logical AND A&&B || Logical OR A||B ! Logical NOT !a Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 44. Conditional Operator A ternary operator pair "?:" is available in c construct conditional expression of the forms. Exp1 ? Exp2: Exp3; Example : If(a>b) X=a; Else X=b; Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 45. UnaryOperator Operator Meaning + Unary Plus - Unary minus ++ Increment -- Decrement ! Logical implement Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE) & Addressofoperator
  • 46. BitwiseOperator Operator Meaning Example & Binary ANDOperator (A& B) = 12, i.e., 00001100 | Binary OR Operator (A| B) = 61, i.e., 0011 1101 ^ Binary Ex-OR Operator (A^ B) = 49, i.e., 0011 0001 >> Binary Right Shift Operator A >>2 = 15 i.e., 00001111 << Binary LeftShift Operator A <<2 = 240 i.e., 1111 0000 ~ Binary One'sComplement Operator (~A) = ~(60), i.e,. 1100 0011 Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 47. Data Type in C++ Data ’রধরর্ন ইসোধোরর্ত কডটো টোইপ বিো হয় । Datatypes in C++ User define data-type Build in datatype Derive data-type Integer Floating point number int char float doublevoid bool • Structure • Union • Class • enumeration • Array • Pointer • Function • etc Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 48. Modifiers Variable এ কম কডটো টোইপ বযবহোর রো হয়,কসগুনিো Modifier রো । 4 types of Modifiers in C++ ✓ signed. ✓ unsigned. ✓ long ✓ short Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 49. Data Type Size(in bytes) Range shortint 2 -32768 to 32767 unsigned short int 2 0 to 65535 unsigned int 4 0 to 4294967295 int 4 -2147483648to2147483647 unsigned long int 4 0 to 4294967295 long long int 8 -(2^63)to (2^63)^-1 unsigned long long int 8 0 to 18446744073709551615 signed char 1 -128 to 127 unsigned char 1 0 to 255 float 4 3.4E - 38 to 3.4E + 38 double 8 1.7E-308 to 1.7E +308 long double 10 3.4E - 4932 to 3.4E + 4932 wchar-t 2 to 4 1 wide character long int 4 -2147483648to2147483647 Bytes and Range Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 50. FormattingoutputinC++ ক োন এ টি Data type ক অনয এ টি Data type এ রূপোন্তর রো । Typecasting ▪showpoint ▪noshowpoint ▪fixed ▪setw() ▪setprecision Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 51. DecisionmakingStatement Decision making statement is depending on the condition block need to be executedor not which is decided by condition. If the condition is "true" statement block will be executed,if condition is "false"then statement block will not be executed. Therearethreetypesof decision makingstatement: ➢ if ➢ if-else ➢ switch Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 52. if -Statement Basic Syntax : if(condition) { ....... ....... } Condition ConditionBlock Flowchart: if condition is false if condition is true Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 53. elseStatement Condition Condition Block Flowchart: if condition is false if condition is true else body Basic Syntax : if(condition) { ....... ....... } else { …........ ......... } Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 54. if else/elseif Statement Basic Syntax : if(condition) { …...... ........ } elseif(condition) { …....... .......... } elseif(condition) { …........ …...... } else { …... …... } if condition else if 2 Flowchart: false else if condition 2 else if condition 1 if body else if 1 else body false false true true true Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 55. SwitchStatement Statementn Statement3 Statement2 Statement1 Break Break Break Expression Case 1 Case 1 Case 1 default Basic Syntax : switch(expression/variable) { case 1: //statements break; case 1: //statements break; case 2: //statements break; . . default: //statements } Flowchart: Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 56. Loops in C++ A loop statementallowsusto executeastatementorgroupof statementsmultiple times. Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE) forloop while loop do...while loop nested loop Sr.No Loop Type & Description 1 while loop Repeats a statementor group of statements while agiven conditionis true. It tests the condition beforeexecutingthe loop body. 2 for loop Executes a sequence of statementsmultiple times andabbreviatesthe code thatmanagesthe loop variable. 3 do...while loop Itis more like a while statement, except thatit tests the conditionatthe end of theloop body. 4 nestedloops You canuse oneor moreloops inside any other while, for,or do..while loop. C++programminglanguageprovidesthefollowingtypesofloopsto handle looping requirements.
  • 57. initialization; while(condition) { statement(s); increment/decrement; } while loop Basic Syntax : Condition code Block Flowchart: if condition is false if condition is true Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE) initialization
  • 58. initialization; do { statement(s); increment/decrement; } while( condition ); Basic Syntax : do...while loop Condition Code Block if condition is false if condition is true Flowchart: initialization; Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 59. Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE) for loop Basic Syntax : for(init; condition; increment) { statement(s); } Condition code Block Flowchart : if condition is false if condition is true initialization increment
  • 60. for ( init; condition; increment ) { for ( init; condition; increment ){ statement(s); } statement(s); } do{ statement(s); do{ statement(s); }while(condition); }while(condition); while(condition){ while(condition){ statement(s); } statement(s); } nested loops in c++ while loop do...while for loop Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE) Basic Syntax :
  • 61. JumpStatementinC++ jump statements are used to interrupt the normal flow of program. Types of Jump Statements : •Break •Continue •GoTo Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 62. goto label; - - - - - - - - - - - - - - - - - - - - label: - - - - - - - - - - - - - - - - - - - - int a=0; while(a<10) { a++; if(a==5 continue; cout << "nStatement " << a; } cout << "nEnd of Program."; } Thebreakstatementis usedinside loopor switch statement. Jump Statements break continue Go to Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE) Basic Syntax : while(a<=10) { if(a==5) break; cout << "nStatement " << a; a++; } cout << "nEnd of Program."; } The continue statement is also used inside loop. The goto statement is a jump statement which jumps from one point to another point within a function.
  • 63. Array An array is a collection of variable of same data type. Array declaration : data_typearray_name[array-size] Example : int mark[100] Array initialization: int marks[0]= 80; Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE) Initialization array during declaration : int marks[5]= {80,65,75,82,45};
  • 64. TypesofArray Array Multi-dimentional arraysOne - dimentional array or Three dimentionalarrayTwodimentional array or matrix arrays Linear arrays Exm : int marks[10]; Exm : int marks[2][3]; Exm : int marks[2][3][2]; Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 65. Pointer(*) Pointer is a variable that stores/points the address of another variable. Pointer এমন এ টি variable মোর মনধয অনয এ টো variable এর address, store ম্প ংবো points রনত পোম্পর । Declarationof pointers: data_type * variable_name. Example : int * p; asterisk symbol Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 66. Symbolofpointer Therearetwosymbols of pointer: i.&(address of variable) :Thissymbol used to get the address ofthe variable . ii. asterisk (*): It is used to create pointer variable. int x = 5; int *p; cout<<x<<endl; cout<<&x<<endl; cout<<p<<endl; cout<<*p<<endl; Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 67. Function A function is a group of statement that perform a particular task. ক োন এ টি ম্পনম্পর্িদ োজ সিোর্ননর জনয অনন গুনিো statement এর সমন্বনয় ঠিত single এ টি unit ক Function বনি । Function Libraryfunction User-definedfunction▪ কম function গুনিো ততম্পর রো আনছ । get ch() toupper() toloweer() pow() sqrt() ▪ কম function গুনিো ততম্পর রো হয়। Provided by:JubairAhmed Junjun B.ScinComputerScience&Engineering(CSE)
  • 68. Declarationof a function void addition(int a,int b) { int sum = a+b; cout<<sum; } Return type Function name Parameter Body of the function Advantageoffunction : ➢ Code Reusability. ➢ Can use the same function for different inputs. Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 69. Function Overloading • Function overloading হনিো এমন এ টো process কমিোনন এ র অম্পধ ফোংেননর নোম এ ই থো নব ,ম্প ন্তু পযোরোম্পমটোর ম্পভন্ন হনব । i.Multiple functions with the samename. ii.differentparameters. Example : void sum(int a,intb) { int sum =a+b; cout<<sum<<endl; } void(int a,intb,int c) { int sum = a+b+c; cout<<sum<<endl; } Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 70. Recursion Recursion is a processwhere a function can call itself. Recursion হনিো এমন এ টি process কমিোনন এ টি ফোংেন ম্পননজন ই ম্পননজন call নর । 2 important poits in case of recursion : ▪ RecursionCall. ▪ Base case. Example: int fact(intn) { //base case if(n==1) return 1; else { return n*fact(n-1) } fact(4) 4*fact(3) 3*fact(2) 2*fact(1) 1 if n = 4; Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 71. OOP(ObjectOrientedProgramming) ➢C + OOP = C++. ➢Real life object .Example : Human , device etc. ➢Object-oriented programming consist to implement real-world entities like inheritance, hiding, polymorphism, etc in programming. ➢The main aim of OOP is to bind togetherthe data and the functions that operate on them so that no other part of the code can access this data exceptthat function. Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 73. Class and Object DB CA 003 004002001 Object ClassStudent Name Roll No SetName() SetRollNo() State Variable Behavior/function Class Fig : Class and object Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 74. ClassandObject অনন গুনিো Object এর common collection ই হনিো Class । Class : A class is a template from which individual object can be created. Object : Any class type variable is called object. Declaration of classand object : classStudent { private: //data member public : //member function }; Student AStudent B Student C class Object of Studentclass Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 75. Constructor Constructor is a specialtype of function that is used to initialized the object. Constructor হনিো কস্পেোি টোইপঅব ফোংেন,মোরসোহোনময objectক initialized রো মোয় । অথদোৎobjectএর মোন set নরকর্ওয়ো মোয় । Propertiesof constructor : ➢ Constructor is a specialtype of function. ➢ Constructor has the samenameas that of the class it belongs. ➢ It has no return type not even void. ➢ It's called automatically. Typesof constructor Defaultconstructor Parameterizedconstructor ▪ Without parameter ▪ With parameter Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 76. Destructor Destructor হসলো এমন একটি ফোিংিন যো Automatically create হসব ,যখন প্কোন একটি object delete বো destroyed করসব । এ টি কেোগ্রোনম এ টি মোত্র Destructor বযবহোর করো যোয় । Destructor এর মসধয প্কোন parameter বযবহোর করোর রসয়োেন পসে নো । Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 77. Access Specifiers in C++ ক োন এ টি Class এর Member ক অথদোৎ Variableঅথবো function ক বোইনর কথন Access রো মোনব ম্প মোনব নো কসটো ম্পনভদ র রনব AccessSpecifiers এর উপর । In C++, there are three access specifiers: o public - members are accessible from outside the class o private - members cannot be accessed (or viewed) from outside the class o protected - members cannot be accessed from outside the class, however, they can be accessed in inherited classes. You will learn more about Inheritance later. Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 78. Syntax of Access specifiers class Test { public: int roll; void display() { ----------------- ----------------- } private: string name; protected: float cgpa; }; Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 79. Encapsulation Encapsulation is a processof combining variables and functions in a string unit(class). Encapsulation িব্দটি এসেসছ capsul প্র্সক । capsul প্যমন অসনকগুসলো উপোদোন মনসয় গঠিত,প্তমমন Encapsulation হসলো এমন একটি রসেে প্যখোসন variables এবিং functions প্ক একেোসর্ কসর একটি class এ রোখো হয় । Click to addtext Encapsulations Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 80. this keyword ➢ Class variable এবং local variable এর মম্পর্ এ ই নোম হনয় মোয়,তোহনি Class variable ক বুঝোননোর জনয this keyword বযবহোর রো হয় । ➢ এন (this->) দ্বোরো ে োে রো হয় । Example : classstudent{ public: string name; Student(string name) { this->name=name ; } void display(){ cout<<name<<endl; } }; Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 81. Inheritance The process of obtaining the datamembersandfunctions fromone class to anotherclass is knownas inheritance. ক োন এ টি class এর তবম্পেি অনয এ টি class এ ম্পননয় মোওয়োন বিো হয় Inheritance। কম Class ক inherit রো হয় কম Class টো inherit নর Parent class/ Base class/ Super class/ Mother class Child class/ Derived class/ Sub class/ Daughter class Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 82. class person{ public : stringname; int age; void display1(){ cout<<"Name : "<<name<<endl; cout<<"Age: "<<age<<endl; } }; class student{ public : stringname; int age; int id; void display2(){ cout<<"Name : "<<name<<endl; cout<<"Age: "<<age<<endl; cout<<"Id: "<<id<<endl; } }; class person : public person{ public : int id ; //stringname; //int age; //void display1() void display2(){ cout<<"Id : "<<id<<endl; } }; If studentclassinherit theperson class Inheritance Example Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 83. Importanceof inheritance ➢Code Resuability. ➢Application development time is less. ➢Application take less memory. ➢Inheritance makes the application code more flexible to change. ➢The program structure is short and concise which is more reliable. ➢It improves the program structure which can be readable. Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 84. Types of Inheritance Thereare5 types of inheritance: i. Single inheritance ii. Multilevelinheritance iii. Hierarchicalinheritance iv. Multiple inheritance v. Hybride inheritance Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 85. Single inheritance In this shortof inheritance,onesubclass inheritsfromonesuperclass. এ মোত্র Superclass ক মম্পর্ এ টি মোত্র sub class inherit নর , তোন Single inheritanceবনি। classA { ---------- ---------- }; classB: public A { ---------------- ---------------- } A B Super Class Sub Class Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 86. Multilevelinheritance In this shortof inheritance,thesuperclass foroneis the subclass foranother. কমিোননএন রঅম্পধ super clas ও subclass থো নব,এবংএ টি আনর টিন inherit রনবতোন Multilevelinheritance বসল। class A { ---------- ---------- }; class B: public A { ---------------- ---------------- }; class C: public B { ---------------- ---------------- }; A B C Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 87. Hierarchicalinheritance In shortof inheritance, multiple sub class derived fromsingle super class মম্পর্ এ টি superclass ক অনন গুনিোsub class inherit নর, তোন Hierarchicalinheritanceবনি। class A { ---------- ---------- }; class B: public A { ---------------- ---------------- }; class C: public A { ---------------- ---------------- }; A B C D Super Class Sub Class Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 88. Multiple inheritance In shortmultiple inheritance, A class can inheritmorethanoneclass. ➢ ক োনclass এন র অম্পধ class ক inherit রনি,তোন Multipleinheritance বনি। ➢ এ টি single class এর এ োম্পধ Parentclass থো ো । ClassA SuperClass ClassB ClassC Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 89. Hybrid Inheritance Hybrid inheritanceis a combination of more than one type of inheritance. ➢ এন র অম্পধ inheritance ম্পমম্পিত হনয়কম inheritance ততম্পরহয়, তোন Hybrid Inheritance বনি। ClassA ClassC ClassB ClassD Single inheritance Multiple inheritance Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 90. Function Overloading vs Function Overriding ➢ Parameterম্পভন্নম্পভন্ন থো নব । ➢ Overloading একই class এর মসধয হয় । ➢ Inheritanceএর রসয়োেন হয় নো । ➢ একটি ফোিংিনঅনয ফোিংিনসকhide কসর নো । ➢ Checked at compile time . ➢ Parameterএ ই থো নব । ➢ এসকর অমধক class,অর্থ াোৎএকটি superclass এবিং sub class এর মসধয হয় । ➢ Inheritanceএর রসয়োেন হয়। ➢ একটি ফোিংিনঅনয ফোিংিনসকhide কসর । ➢ Checked at run time. Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 91. Polymorphism Polymorphism= Poly + morphism(2 Greekword). Many Forms প্কোন একটি মেমনসের মভন্ন মভন্ন রূপসক Polymorphism বসল । Polymorphism Compile time Polymorphism Run time polymorphism (Static or early binding) (Dynamic or late binging) Exam : function overloading Exam : function overriding Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 92. Abstraction Abstraction is the process of hidingthe implementation details andshowingonly the functionalityto the user. Abstractionহনিো এমন এ টি েনসস কমটো implementation details টো hide নর শুধুমোত্র functionality টো user ক কর্িোনব । কমোযো থো,Abstruction হনিো এমন এ টি ম্পজম্পনস কমটো অভযন্তরীর্ ম্পজম্পনস user ক কর্িোনব নো,কসটো hide নর রোিনব।ম্প ন্তু বোইনরর ম্পজম্পনসগুনিো user Access রনত পোরনব । Example : ATM,Message send,Calletc. Properties of Abstracclass: ➢ Object Can'nt be created. Exm : Mobile user m; ➢ We can create pointer andreferenceof base abstractclasspoints. Exam : Mobile user *m; ➢ It can have Constructor. Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 93. Function Template ম্পভন্ন ম্পভন্ন datatypeএর জনয ম্পভন্ন ম্পভন্ন ফোংেন ততম্পর নো নর এমন এ টি ফোংেন ততম্পর রো মোর মনধয সব ধরনর্র datatype োজ রনব । অথদোৎ এমন এ টি ফোংেন ততম্পর রো মো int,float ম্প ংবো double type এর কম ক োন datatype এর জনয োজ রনব । template<class myTemplate> myTemplate add(myTemplatea,myTemplateb) { returna+b; } Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 94. ExceptionHandling ▪ Exception is a run time Error. ▪ Exception handlingis a machanismthatcan handletheexception. Error Compiletimeerror Run time error Programরোন করোর পূসবথ । Programরোন করোর েময় বো চলোকোলীন েম য় । There are three Keyword in ExceptionHandling : ➢ Try ➢ Catch ➢ Throw Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 95. Try,Catch,throw try catch throw A try block identifies a block of code for which particular exceptionswill be activated. It's followed by one or more catch blocks. catch− A programcatchesan exceptionwith an exception handlerat theplace in a program where you wantto handlethe problem. The catchkeyword indicates the catchingof an exception. throw − Aprogramthrowsan exceptionwhen a problem shows up. This is done using a throw keyword. try { // protectedcode } catch( ExceptionNamee ) { // code to handleExceptionName exception } try { // protectedcode } catch( ExceptionNamee ) { // code to handleExceptionNameexc eption } double division(int a, int b) { if( b == 0 ) { throw "Division by zero condition!"; } return (a/b); } Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)
  • 96. Join with me Fbpage: https://www.facebook.com/jajsofttech Fbgroup: https://www.facebook.com/groups/2704079586349093 YouTube:https://www.youtube.com/c/JubairAhmedJunjun/videos?view_as=subscriber LinkedIn : https://www.linkedin.com/in/jubair-ahmed-junjun-4ab6a0177/ Providedby :Jubair AhmedJunjun B.Sc inComputer Science&Engineering(CSE)