SlideShare ist ein Scribd-Unternehmen logo
1 von 37
Migration: C to C++ 09/09/2009 1 Hadziq Fabroyir - Informatics ITS
C/C++ Program Structure Operating System void function1() { 	//... 	return; } int main() { 	function1(); 	function2(); 	function3(); 	return 0; } void function2() { 	//... 	return; } void function3() { 	//... 	return; } Operating System
Naming Variable MUST Identifier / variable name can include letters(A-z), digits(0-9), and underscore(_) Identifier starts with letteror underscore Do NOT use keywordsas identifier Identifier in C++ is case-sensitive CONSIDER Usemeaningfullname Limit identifier length up to 31 characters, although it can have length up to 2048 Avoid using identifiers that start with an underscore 09/09/2009 Hadziq Fabroyir - Informatics ITS 3
Keywords 09/09/2009 Hadziq Fabroyir - Informatics ITS 4
Declaring Variable 09/09/2009 Hadziq Fabroyir - Informatics ITS 5 int value; char[] firstName; Char[] address;	 int 9ball; long bigInt; System::String full_name; int count!; long class; float a234_djJ_685_abc___;
Initializing Variable int value = 0;					 char[] firstName = “Budi”;				 long bigInt(100L); System::String^ full_name = “Budi Lagi”; 09/09/2009 Hadziq Fabroyir - Informatics ITS 6
Fundamental Data Types 09/09/2009 Hadziq Fabroyir - Informatics ITS 7
Literals 09/09/2009 Hadziq Fabroyir - Informatics ITS 8
Example of Data Types int main() { 	char c = 'A'; 	wchar_t wideChar = L'9'; 	int i = 123; 	long l = 10240L; 	float f = 3.14f; 	double d = 3.14; 	bool b = true; 	return 0; } 09/09/2009 Hadziq Fabroyir - Informatics ITS 9
Enumerations Variable with specific sets of values Enum Day {Mon, Tues, Wed, Thurs, Fri, Sat, Sun}; Day today = Mon; Enum Day {Mon = 1, Tues, Wed, Thurs, Fri, Sat, Sun}; Day nextDay = Tues; 09/09/2009 Hadziq Fabroyir - Informatics ITS 10
Basic Input/Output Operations int main() { 	//declare and initialize variables 	int num1 = 0; 	int num2 = 0; 	//getting input from keyboard 	cin >> num1 >> num2; 	//output the variables value to command line 	cout << endl; 	cout << "Num1 : " << num1 << endl; 	cout << "Num2 : " << num2; 	return 0; } 09/09/2009 Hadziq Fabroyir - Informatics ITS 11
Escape Sequence 09/09/2009 Hadziq Fabroyir - Informatics ITS 12
Basic Operators int main() { 	int a = 0; 	int b = 0; 	int c = 0; 	c = a + b; 	c = a - b; 	c = a * b; 	c = a / b; 	c = a % b; 	a = -b;	 	return 0; } 09/09/2009 Hadziq Fabroyir - Informatics ITS 13
Bitwise Operators 09/09/2009 Hadziq Fabroyir - Informatics ITS 14 &	bitwise AND ~ 	bitwise NOT | 	bitwise OR ^ 	bitwise XOR >>shift right <<shift left
Increment and Decrement Operators int main() { 	int a = 0; 	int b = 0; 	a++; 	b--; ++a; 	++b;	 	return 0; } 09/09/2009 Hadziq Fabroyir - Informatics ITS 15
Shorthand Operators int main() { 	int a = 0; 	int b = 0; 	a += 3; 	b -= a; 	a *= 2; 	b /= 32; 	a %= b;	 	return 0; } 09/09/2009 Hadziq Fabroyir - Informatics ITS 16
Explicit Casting static_cast<the_type_to_convert_to>(expression) (the_type_to_convert_to)expression 09/09/2009 Hadziq Fabroyir - Informatics ITS 17
Constant Declaration int main() { const double rollwidth = 21.0;    const double rolllength = 12.0*33.0;    const double rollarea = rollwidth*rolllength;    return 0; } 09/09/2009 Hadziq Fabroyir - Informatics ITS 18
Declaring Namespace namespace MyNamespace { 	// code belongs to myNamespace } namespace OtherNamespace { 	// code belongs to otherNamespace } 09/09/2009 Hadziq Fabroyir - Informatics ITS 19
Using Namespace #include <iostream> namespace myStuff { int value = 0; } int main() { std::cout << “enter an integer: “; std::cin >> myStuff::value; std::cout << “You entered “ << myStuff::value << std:: endl; return 0; } #include <iostream> namespace myStuff {            int value = 0; } using namespace myStuff; int main() { std::cout << “enter an integer: “; std::cin >> value; std::cout << “You entered “ << value<< std:: endl; return 0; } 09/09/2009 Hadziq Fabroyir - Informatics ITS 20
Visual C++ Programming Environment Hadziq Fabroyir - Informatics ITS ISO/ANSI C++ (unmanaged) C++/CLI .NET Framework Managed C++ Native C++ Framework Classes Native C++ MFC Common Language Runtime (CLR) Operating System HHardware 09/09/2009 21
C++/CLI Data Types 09/09/2009 Hadziq Fabroyir - Informatics ITS 22
ITC1398 Introduction to Programming Chapter 3 23 Control Structures Three control structures  Sequence structure Programs executed sequentially by default Selection structures if, if…else, switch Repetition structures while, do…while, for
ITC1398 Introduction to Programming Chapter 3 24 if Selection Statement Choose among alternative courses of action Pseudocode example If student’s grade is greater than or equal to 60      print “Passed” If the condition is true Print statement executes, program continues to next statement If the condition is false Print statement ignored, program continues
Activity Diagram 09/09/2009 Hadziq Fabroyir - Informatics ITS 25
ITC1398 Introduction to Programming Chapter 3 26 if Selection Statement Translation into C++ if ( grade >= 60 )    cout << "Passed"; Any expression can be used as the condition If it evaluates to zero, it is treated as false If it evaluates to non-zero, it is treated as true
ITC1398 Introduction to Programming Chapter 3 27 if…else Double-Selection Statement if Performs action if condition true if…else Performs one action if condition is true, a different action if it is false Pseudocode If student’s grade is greater than or equal to 60     print “Passed”Else     print “Failed”  C++ code if ( grade >= 60 )    cout << "Passed";else   cout << "Failed";
Activity Diagram 09/09/2009 Hadziq Fabroyir - Informatics ITS 28
ITC1398 Introduction to Programming Chapter 3 29 if…else Double-Selection Statement Ternary conditional operator (?:) Three arguments (condition, value if true, value if false) Code could be written: cout << ( grade >= 60 ? “Passed” : “Failed” ); Condition Value if true Value if false
ITC1398 Introduction to Programming Chapter 3 30 if…else Double-Selection Statement Nested if…else statements One inside another, test for multiple cases  Once a condition met, other statements are skipped Example              If student’s grade is greater than or equal to 90                   Print “A”              Else           If student’s grade is greater than or equal to 80	              Print “B”         Else                If student’s grade is greater than or equal to 70 	                    Print “C”	               Else 	                    If student’s grade is greater than or equal to 60 	                         Print “D”                    Else                            Print “F”
ITC1398 Introduction to Programming Chapter 3 31 if…else Double-Selection Statement Nested if…else statements (Cont.) Written In C++ if ( studentGrade >= 90 )    cout << "A";elseif (studentGrade >= 80 )       cout << "B";elseif (studentGrade >= 70 )          cout << "C";  elseif ( studentGrade >= 60 )             cout << "D";else            cout << "F";
while Repetition Statement A repetition statement (also called a looping statement or a loop) allows the programmer to specify that a program should repeat an action while some condition remains true. The pseudocode statement While there are more items on my shopping list Purchase next item and cross it off my list  09/09/2009 Hadziq Fabroyir - Informatics ITS 32
for Repetition Statement 09/09/2009 Hadziq Fabroyir - Informatics ITS 33
do …while Repetition Statement do {  statement  } while ( condition ); 09/09/2009 Hadziq Fabroyir - Informatics ITS 34
switch Multiple-Selection Statement 09/09/2009 Hadziq Fabroyir - Informatics ITS 35
For your practice … Lab Session I (Ahad, 19.00-21.00) 4.14  5.20  6.27 Lab Session II (Senin, 19.00-21.00) 4.35  5.12  6.30 09/09/2009 Hadziq Fabroyir - Informatics ITS 36
☺~ Next: OOP using C++ ~☺ [ 37 ] Hadziq Fabroyir - Informatics ITS 09/09/2009

Weitere ähnliche Inhalte

Was ist angesagt?

Programming fundamental 02
Programming fundamental 02Programming fundamental 02
Programming fundamental 02Suhail Akraam
 
C programming session 02
C programming session 02C programming session 02
C programming session 02Vivek Singh
 
Glimpses of C++0x
Glimpses of C++0xGlimpses of C++0x
Glimpses of C++0xppd1961
 
Unit 2 c programming_basics
Unit 2 c programming_basicsUnit 2 c programming_basics
Unit 2 c programming_basicskirthika jeyenth
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02Wingston
 
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...corehard_by
 
VTU PCD Model Question Paper - Programming in C
VTU PCD Model Question Paper - Programming in CVTU PCD Model Question Paper - Programming in C
VTU PCD Model Question Paper - Programming in CSyed Mustafa
 
Control Statements, Array, Pointer, Structures
Control Statements, Array, Pointer, StructuresControl Statements, Array, Pointer, Structures
Control Statements, Array, Pointer, Structuresindra Kishor
 
Chap 2 input output dti2143
Chap 2  input output dti2143Chap 2  input output dti2143
Chap 2 input output dti2143alish sha
 
Overview of c++ language
Overview of c++ language   Overview of c++ language
Overview of c++ language samt7
 
C++ Programming Language
C++ Programming Language C++ Programming Language
C++ Programming Language Mohamed Loey
 
Important C program of Balagurusamy Book
Important C program of Balagurusamy BookImportant C program of Balagurusamy Book
Important C program of Balagurusamy BookAbir Hossain
 
Programming with c language practical manual
Programming with c language practical manualProgramming with c language practical manual
Programming with c language practical manualAnil Bishnoi
 

Was ist angesagt? (20)

Deep C
Deep CDeep C
Deep C
 
Programming fundamental 02
Programming fundamental 02Programming fundamental 02
Programming fundamental 02
 
C programming session 02
C programming session 02C programming session 02
C programming session 02
 
Glimpses of C++0x
Glimpses of C++0xGlimpses of C++0x
Glimpses of C++0x
 
Unit 2 c programming_basics
Unit 2 c programming_basicsUnit 2 c programming_basics
Unit 2 c programming_basics
 
Programming C Part 03
Programming C Part 03Programming C Part 03
Programming C Part 03
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
 
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
 
VTU PCD Model Question Paper - Programming in C
VTU PCD Model Question Paper - Programming in CVTU PCD Model Question Paper - Programming in C
VTU PCD Model Question Paper - Programming in C
 
Control Statements, Array, Pointer, Structures
Control Statements, Array, Pointer, StructuresControl Statements, Array, Pointer, Structures
Control Statements, Array, Pointer, Structures
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Basics of C porgramming
Basics of C porgrammingBasics of C porgramming
Basics of C porgramming
 
Chap 2 input output dti2143
Chap 2  input output dti2143Chap 2  input output dti2143
Chap 2 input output dti2143
 
Overview of c++ language
Overview of c++ language   Overview of c++ language
Overview of c++ language
 
C++ Programming Language
C++ Programming Language C++ Programming Language
C++ Programming Language
 
Important C program of Balagurusamy Book
Important C program of Balagurusamy BookImportant C program of Balagurusamy Book
Important C program of Balagurusamy Book
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
 
C if else
C if elseC if else
C if else
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
Programming with c language practical manual
Programming with c language practical manualProgramming with c language practical manual
Programming with c language practical manual
 

Andere mochten auch

#OOP_D_ITS - 3rd - Pointer And References
#OOP_D_ITS - 3rd - Pointer And References#OOP_D_ITS - 3rd - Pointer And References
#OOP_D_ITS - 3rd - Pointer And ReferencesHadziq Fabroyir
 
#OOP_D_ITS - 8th - Class Diagram
#OOP_D_ITS - 8th - Class Diagram#OOP_D_ITS - 8th - Class Diagram
#OOP_D_ITS - 8th - Class DiagramHadziq Fabroyir
 
10 Curso de POO en java - métodos modificadores y analizadores
10 Curso de POO en java - métodos modificadores y analizadores10 Curso de POO en java - métodos modificadores y analizadores
10 Curso de POO en java - métodos modificadores y analizadoresClara Patricia Avella Ibañez
 
11 Curso de POO en java - métodos constructores y toString()
11 Curso de POO en java - métodos constructores y toString()11 Curso de POO en java - métodos constructores y toString()
11 Curso de POO en java - métodos constructores y toString()Clara Patricia Avella Ibañez
 
8b Curso de POO en java - paso de diagrama clases a java 1
8b Curso de POO en java - paso de diagrama clases a java 18b Curso de POO en java - paso de diagrama clases a java 1
8b Curso de POO en java - paso de diagrama clases a java 1Clara Patricia Avella Ibañez
 

Andere mochten auch (6)

#OOP_D_ITS - 3rd - Pointer And References
#OOP_D_ITS - 3rd - Pointer And References#OOP_D_ITS - 3rd - Pointer And References
#OOP_D_ITS - 3rd - Pointer And References
 
#OOP_D_ITS - 8th - Class Diagram
#OOP_D_ITS - 8th - Class Diagram#OOP_D_ITS - 8th - Class Diagram
#OOP_D_ITS - 8th - Class Diagram
 
10 Curso de POO en java - métodos modificadores y analizadores
10 Curso de POO en java - métodos modificadores y analizadores10 Curso de POO en java - métodos modificadores y analizadores
10 Curso de POO en java - métodos modificadores y analizadores
 
18 Curso POO en java - contenedores
18 Curso POO en java - contenedores18 Curso POO en java - contenedores
18 Curso POO en java - contenedores
 
11 Curso de POO en java - métodos constructores y toString()
11 Curso de POO en java - métodos constructores y toString()11 Curso de POO en java - métodos constructores y toString()
11 Curso de POO en java - métodos constructores y toString()
 
8b Curso de POO en java - paso de diagrama clases a java 1
8b Curso de POO en java - paso de diagrama clases a java 18b Curso de POO en java - paso de diagrama clases a java 1
8b Curso de POO en java - paso de diagrama clases a java 1
 

Ähnlich wie #OOP_D_ITS - 3rd - Migration From C To C++

Programming basics
Programming basicsProgramming basics
Programming basics246paa
 
presentation_python_11_1569171345_375360.pptx
presentation_python_11_1569171345_375360.pptxpresentation_python_11_1569171345_375360.pptx
presentation_python_11_1569171345_375360.pptxGAURAVRATHORE86
 
C++ Programming Club-Lecture 2
C++ Programming Club-Lecture 2C++ Programming Club-Lecture 2
C++ Programming Club-Lecture 2Ammara Javed
 
An imperative study of c
An imperative study of cAn imperative study of c
An imperative study of cTushar B Kute
 
COM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & BranchingCOM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & BranchingHemantha Kulathilake
 
C decision making and looping.
C decision making and looping.C decision making and looping.
C decision making and looping.Haard Shah
 
Expressions using operator in c
Expressions using operator in cExpressions using operator in c
Expressions using operator in cSaranya saran
 
C++ and OOPS Crash Course by ACM DBIT | Grejo Joby
C++ and OOPS Crash Course by ACM DBIT | Grejo JobyC++ and OOPS Crash Course by ACM DBIT | Grejo Joby
C++ and OOPS Crash Course by ACM DBIT | Grejo JobyGrejoJoby1
 
Control Structures in C
Control Structures in CControl Structures in C
Control Structures in Csana shaikh
 
Introduction to programming c and data-structures
Introduction to programming c and data-structures Introduction to programming c and data-structures
Introduction to programming c and data-structures Pradipta Mishra
 
Understand more about C
Understand more about CUnderstand more about C
Understand more about CYi-Hsiu Hsu
 

Ähnlich wie #OOP_D_ITS - 3rd - Migration From C To C++ (20)

operators.ppt
operators.pptoperators.ppt
operators.ppt
 
Elements of programming
Elements of programmingElements of programming
Elements of programming
 
Programming basics
Programming basicsProgramming basics
Programming basics
 
CP Handout#4
CP Handout#4CP Handout#4
CP Handout#4
 
presentation_python_11_1569171345_375360.pptx
presentation_python_11_1569171345_375360.pptxpresentation_python_11_1569171345_375360.pptx
presentation_python_11_1569171345_375360.pptx
 
C++ Programming Club-Lecture 2
C++ Programming Club-Lecture 2C++ Programming Club-Lecture 2
C++ Programming Club-Lecture 2
 
An imperative study of c
An imperative study of cAn imperative study of c
An imperative study of c
 
C Programming
C ProgrammingC Programming
C Programming
 
Control All
Control AllControl All
Control All
 
175035 cse lab-05
175035 cse lab-05 175035 cse lab-05
175035 cse lab-05
 
COM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & BranchingCOM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & Branching
 
Statement
StatementStatement
Statement
 
C decision making and looping.
C decision making and looping.C decision making and looping.
C decision making and looping.
 
Expressions using operator in c
Expressions using operator in cExpressions using operator in c
Expressions using operator in c
 
Ch4
Ch4Ch4
Ch4
 
ICP - Lecture 7 and 8
ICP - Lecture 7 and 8ICP - Lecture 7 and 8
ICP - Lecture 7 and 8
 
C++ and OOPS Crash Course by ACM DBIT | Grejo Joby
C++ and OOPS Crash Course by ACM DBIT | Grejo JobyC++ and OOPS Crash Course by ACM DBIT | Grejo Joby
C++ and OOPS Crash Course by ACM DBIT | Grejo Joby
 
Control Structures in C
Control Structures in CControl Structures in C
Control Structures in C
 
Introduction to programming c and data-structures
Introduction to programming c and data-structures Introduction to programming c and data-structures
Introduction to programming c and data-structures
 
Understand more about C
Understand more about CUnderstand more about C
Understand more about C
 

Mehr von Hadziq Fabroyir

An Immersive Map Exploration System Using Handheld Device
An Immersive Map Exploration System Using Handheld DeviceAn Immersive Map Exploration System Using Handheld Device
An Immersive Map Exploration System Using Handheld DeviceHadziq Fabroyir
 
在不同尺度遙現系統中具空間感知特性的使用者介面開發
在不同尺度遙現系統中具空間感知特性的使用者介面開發在不同尺度遙現系統中具空間感知特性的使用者介面開發
在不同尺度遙現系統中具空間感知特性的使用者介面開發Hadziq Fabroyir
 
NTUST Course Selection (Revision: Fall 2016)
NTUST Course Selection (Revision: Fall 2016)NTUST Course Selection (Revision: Fall 2016)
NTUST Course Selection (Revision: Fall 2016)Hadziq Fabroyir
 
律法保護的五件事
律法保護的五件事律法保護的五件事
律法保護的五件事Hadziq Fabroyir
 
Pelajaran 5 第五課 • Telepon 給打電話
Pelajaran 5 第五課 • Telepon 給打電話Pelajaran 5 第五課 • Telepon 給打電話
Pelajaran 5 第五課 • Telepon 給打電話Hadziq Fabroyir
 
Pelajaran 4 第四課 • Belanja 買東西
Pelajaran 4 第四課 • Belanja 買東西Pelajaran 4 第四課 • Belanja 買東西
Pelajaran 4 第四課 • Belanja 買東西Hadziq Fabroyir
 
Pelajaran 3 第三課 • Transportasi 交通
Pelajaran 3 第三課 • Transportasi 交通Pelajaran 3 第三課 • Transportasi 交通
Pelajaran 3 第三課 • Transportasi 交通Hadziq Fabroyir
 
Pelajaran 2 第二課 • Di Restoran 在餐廳
Pelajaran 2 第二課 • Di Restoran 在餐廳Pelajaran 2 第二課 • Di Restoran 在餐廳
Pelajaran 2 第二課 • Di Restoran 在餐廳Hadziq Fabroyir
 
Pelajaran 1 第一課 • Perkenalan Diri 自我介紹
Pelajaran 1 第一課 • Perkenalan Diri 自我介紹Pelajaran 1 第一課 • Perkenalan Diri 自我介紹
Pelajaran 1 第一課 • Perkenalan Diri 自我介紹Hadziq Fabroyir
 
Living in Taiwan for Dummies
Living in Taiwan for DummiesLiving in Taiwan for Dummies
Living in Taiwan for DummiesHadziq Fabroyir
 
How to Select Course at NTUST
How to Select Course at NTUSTHow to Select Course at NTUST
How to Select Course at NTUSTHadziq Fabroyir
 
NTUST-IMSA • International Students Orientation
NTUST-IMSA • International Students OrientationNTUST-IMSA • International Students Orientation
NTUST-IMSA • International Students OrientationHadziq Fabroyir
 
NTUST Course Selection - How to
NTUST Course Selection - How toNTUST Course Selection - How to
NTUST Course Selection - How toHadziq Fabroyir
 
#OOP_D_ITS - 9th - Template
#OOP_D_ITS - 9th - Template#OOP_D_ITS - 9th - Template
#OOP_D_ITS - 9th - TemplateHadziq Fabroyir
 
#OOP_D_ITS - 6th - C++ Oop Inheritance
#OOP_D_ITS - 6th - C++ Oop Inheritance#OOP_D_ITS - 6th - C++ Oop Inheritance
#OOP_D_ITS - 6th - C++ Oop InheritanceHadziq Fabroyir
 
#OOP_D_ITS - 5th - C++ Oop Operator Overloading
#OOP_D_ITS - 5th - C++ Oop Operator Overloading#OOP_D_ITS - 5th - C++ Oop Operator Overloading
#OOP_D_ITS - 5th - C++ Oop Operator OverloadingHadziq Fabroyir
 
#OOP_D_ITS - 2nd - C++ Getting Started
#OOP_D_ITS - 2nd - C++ Getting Started#OOP_D_ITS - 2nd - C++ Getting Started
#OOP_D_ITS - 2nd - C++ Getting StartedHadziq Fabroyir
 
#OOP_D_ITS - 4th - C++ Oop And Class Structure
#OOP_D_ITS - 4th - C++ Oop And Class Structure#OOP_D_ITS - 4th - C++ Oop And Class Structure
#OOP_D_ITS - 4th - C++ Oop And Class StructureHadziq Fabroyir
 

Mehr von Hadziq Fabroyir (20)

An Immersive Map Exploration System Using Handheld Device
An Immersive Map Exploration System Using Handheld DeviceAn Immersive Map Exploration System Using Handheld Device
An Immersive Map Exploration System Using Handheld Device
 
在不同尺度遙現系統中具空間感知特性的使用者介面開發
在不同尺度遙現系統中具空間感知特性的使用者介面開發在不同尺度遙現系統中具空間感知特性的使用者介面開發
在不同尺度遙現系統中具空間感知特性的使用者介面開發
 
NTUST Course Selection (Revision: Fall 2016)
NTUST Course Selection (Revision: Fall 2016)NTUST Course Selection (Revision: Fall 2016)
NTUST Course Selection (Revision: Fall 2016)
 
律法保護的五件事
律法保護的五件事律法保護的五件事
律法保護的五件事
 
Pelajaran 5 第五課 • Telepon 給打電話
Pelajaran 5 第五課 • Telepon 給打電話Pelajaran 5 第五課 • Telepon 給打電話
Pelajaran 5 第五課 • Telepon 給打電話
 
Pelajaran 4 第四課 • Belanja 買東西
Pelajaran 4 第四課 • Belanja 買東西Pelajaran 4 第四課 • Belanja 買東西
Pelajaran 4 第四課 • Belanja 買東西
 
Pelajaran 3 第三課 • Transportasi 交通
Pelajaran 3 第三課 • Transportasi 交通Pelajaran 3 第三課 • Transportasi 交通
Pelajaran 3 第三課 • Transportasi 交通
 
Pelajaran 2 第二課 • Di Restoran 在餐廳
Pelajaran 2 第二課 • Di Restoran 在餐廳Pelajaran 2 第二課 • Di Restoran 在餐廳
Pelajaran 2 第二課 • Di Restoran 在餐廳
 
Pelajaran 1 第一課 • Perkenalan Diri 自我介紹
Pelajaran 1 第一課 • Perkenalan Diri 自我介紹Pelajaran 1 第一課 • Perkenalan Diri 自我介紹
Pelajaran 1 第一課 • Perkenalan Diri 自我介紹
 
Living in Taiwan for Dummies
Living in Taiwan for DummiesLiving in Taiwan for Dummies
Living in Taiwan for Dummies
 
How to Select Course at NTUST
How to Select Course at NTUSTHow to Select Course at NTUST
How to Select Course at NTUST
 
NTUST-IMSA • International Students Orientation
NTUST-IMSA • International Students OrientationNTUST-IMSA • International Students Orientation
NTUST-IMSA • International Students Orientation
 
NTUST Course Selection - How to
NTUST Course Selection - How toNTUST Course Selection - How to
NTUST Course Selection - How to
 
Brain Battle Online
Brain Battle OnlineBrain Battle Online
Brain Battle Online
 
Manajemen Waktu
Manajemen WaktuManajemen Waktu
Manajemen Waktu
 
#OOP_D_ITS - 9th - Template
#OOP_D_ITS - 9th - Template#OOP_D_ITS - 9th - Template
#OOP_D_ITS - 9th - Template
 
#OOP_D_ITS - 6th - C++ Oop Inheritance
#OOP_D_ITS - 6th - C++ Oop Inheritance#OOP_D_ITS - 6th - C++ Oop Inheritance
#OOP_D_ITS - 6th - C++ Oop Inheritance
 
#OOP_D_ITS - 5th - C++ Oop Operator Overloading
#OOP_D_ITS - 5th - C++ Oop Operator Overloading#OOP_D_ITS - 5th - C++ Oop Operator Overloading
#OOP_D_ITS - 5th - C++ Oop Operator Overloading
 
#OOP_D_ITS - 2nd - C++ Getting Started
#OOP_D_ITS - 2nd - C++ Getting Started#OOP_D_ITS - 2nd - C++ Getting Started
#OOP_D_ITS - 2nd - C++ Getting Started
 
#OOP_D_ITS - 4th - C++ Oop And Class Structure
#OOP_D_ITS - 4th - C++ Oop And Class Structure#OOP_D_ITS - 4th - C++ Oop And Class Structure
#OOP_D_ITS - 4th - C++ Oop And Class Structure
 

Kürzlich hochgeladen

Call Girls Service Bellary Road Just Call 7001305949 Enjoy College Girls Service
Call Girls Service Bellary Road Just Call 7001305949 Enjoy College Girls ServiceCall Girls Service Bellary Road Just Call 7001305949 Enjoy College Girls Service
Call Girls Service Bellary Road Just Call 7001305949 Enjoy College Girls Servicenarwatsonia7
 
Call Girls Horamavu WhatsApp Number 7001035870 Meeting With Bangalore Escorts
Call Girls Horamavu WhatsApp Number 7001035870 Meeting With Bangalore EscortsCall Girls Horamavu WhatsApp Number 7001035870 Meeting With Bangalore Escorts
Call Girls Horamavu WhatsApp Number 7001035870 Meeting With Bangalore Escortsvidya singh
 
Sonagachi Call Girls Services 9907093804 @24x7 High Class Babes Here Call Now
Sonagachi Call Girls Services 9907093804 @24x7 High Class Babes Here Call NowSonagachi Call Girls Services 9907093804 @24x7 High Class Babes Here Call Now
Sonagachi Call Girls Services 9907093804 @24x7 High Class Babes Here Call NowRiya Pathan
 
VIP Call Girls Indore Kirti 💚😋 9256729539 🚀 Indore Escorts
VIP Call Girls Indore Kirti 💚😋  9256729539 🚀 Indore EscortsVIP Call Girls Indore Kirti 💚😋  9256729539 🚀 Indore Escorts
VIP Call Girls Indore Kirti 💚😋 9256729539 🚀 Indore Escortsaditipandeya
 
Kesar Bagh Call Girl Price 9548273370 , Lucknow Call Girls Service
Kesar Bagh Call Girl Price 9548273370 , Lucknow Call Girls ServiceKesar Bagh Call Girl Price 9548273370 , Lucknow Call Girls Service
Kesar Bagh Call Girl Price 9548273370 , Lucknow Call Girls Servicemakika9823
 
High Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service Jaipur
High Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service JaipurHigh Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service Jaipur
High Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service Jaipurparulsinha
 
Call Girl Coimbatore Prisha☎️ 8250192130 Independent Escort Service Coimbatore
Call Girl Coimbatore Prisha☎️  8250192130 Independent Escort Service CoimbatoreCall Girl Coimbatore Prisha☎️  8250192130 Independent Escort Service Coimbatore
Call Girl Coimbatore Prisha☎️ 8250192130 Independent Escort Service Coimbatorenarwatsonia7
 
Artifacts in Nuclear Medicine with Identifying and resolving artifacts.
Artifacts in Nuclear Medicine with Identifying and resolving artifacts.Artifacts in Nuclear Medicine with Identifying and resolving artifacts.
Artifacts in Nuclear Medicine with Identifying and resolving artifacts.MiadAlsulami
 
Call Girl Service Bidadi - For 7001305949 Cheap & Best with original Photos
Call Girl Service Bidadi - For 7001305949 Cheap & Best with original PhotosCall Girl Service Bidadi - For 7001305949 Cheap & Best with original Photos
Call Girl Service Bidadi - For 7001305949 Cheap & Best with original Photosnarwatsonia7
 
Call Girls Yelahanka Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Yelahanka Just Call 7001305949 Top Class Call Girl Service AvailableCall Girls Yelahanka Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Yelahanka Just Call 7001305949 Top Class Call Girl Service Availablenarwatsonia7
 
Russian Call Girls Chennai Madhuri 9907093804 Independent Call Girls Service ...
Russian Call Girls Chennai Madhuri 9907093804 Independent Call Girls Service ...Russian Call Girls Chennai Madhuri 9907093804 Independent Call Girls Service ...
Russian Call Girls Chennai Madhuri 9907093804 Independent Call Girls Service ...Nehru place Escorts
 
CALL ON ➥9907093804 🔝 Call Girls Baramati ( Pune) Girls Service
CALL ON ➥9907093804 🔝 Call Girls Baramati ( Pune)  Girls ServiceCALL ON ➥9907093804 🔝 Call Girls Baramati ( Pune)  Girls Service
CALL ON ➥9907093804 🔝 Call Girls Baramati ( Pune) Girls ServiceMiss joya
 
Russian Call Girls in Pune Riya 9907093804 Short 1500 Night 6000 Best call gi...
Russian Call Girls in Pune Riya 9907093804 Short 1500 Night 6000 Best call gi...Russian Call Girls in Pune Riya 9907093804 Short 1500 Night 6000 Best call gi...
Russian Call Girls in Pune Riya 9907093804 Short 1500 Night 6000 Best call gi...Miss joya
 
Call Girls Service Chennai Jiya 7001305949 Independent Escort Service Chennai
Call Girls Service Chennai Jiya 7001305949 Independent Escort Service ChennaiCall Girls Service Chennai Jiya 7001305949 Independent Escort Service Chennai
Call Girls Service Chennai Jiya 7001305949 Independent Escort Service ChennaiNehru place Escorts
 
Russian Call Girls in Pune Tanvi 9907093804 Short 1500 Night 6000 Best call g...
Russian Call Girls in Pune Tanvi 9907093804 Short 1500 Night 6000 Best call g...Russian Call Girls in Pune Tanvi 9907093804 Short 1500 Night 6000 Best call g...
Russian Call Girls in Pune Tanvi 9907093804 Short 1500 Night 6000 Best call g...Miss joya
 
VIP Mumbai Call Girls Hiranandani Gardens Just Call 9920874524 with A/C Room ...
VIP Mumbai Call Girls Hiranandani Gardens Just Call 9920874524 with A/C Room ...VIP Mumbai Call Girls Hiranandani Gardens Just Call 9920874524 with A/C Room ...
VIP Mumbai Call Girls Hiranandani Gardens Just Call 9920874524 with A/C Room ...Garima Khatri
 
Russian Call Girl Brookfield - 7001305949 Escorts Service 50% Off with Cash O...
Russian Call Girl Brookfield - 7001305949 Escorts Service 50% Off with Cash O...Russian Call Girl Brookfield - 7001305949 Escorts Service 50% Off with Cash O...
Russian Call Girl Brookfield - 7001305949 Escorts Service 50% Off with Cash O...narwatsonia7
 
Low Rate Call Girls Pune Esha 9907093804 Short 1500 Night 6000 Best call girl...
Low Rate Call Girls Pune Esha 9907093804 Short 1500 Night 6000 Best call girl...Low Rate Call Girls Pune Esha 9907093804 Short 1500 Night 6000 Best call girl...
Low Rate Call Girls Pune Esha 9907093804 Short 1500 Night 6000 Best call girl...Miss joya
 

Kürzlich hochgeladen (20)

Russian Call Girls in Delhi Tanvi ➡️ 9711199012 💋📞 Independent Escort Service...
Russian Call Girls in Delhi Tanvi ➡️ 9711199012 💋📞 Independent Escort Service...Russian Call Girls in Delhi Tanvi ➡️ 9711199012 💋📞 Independent Escort Service...
Russian Call Girls in Delhi Tanvi ➡️ 9711199012 💋📞 Independent Escort Service...
 
Call Girls Service Bellary Road Just Call 7001305949 Enjoy College Girls Service
Call Girls Service Bellary Road Just Call 7001305949 Enjoy College Girls ServiceCall Girls Service Bellary Road Just Call 7001305949 Enjoy College Girls Service
Call Girls Service Bellary Road Just Call 7001305949 Enjoy College Girls Service
 
Call Girls Horamavu WhatsApp Number 7001035870 Meeting With Bangalore Escorts
Call Girls Horamavu WhatsApp Number 7001035870 Meeting With Bangalore EscortsCall Girls Horamavu WhatsApp Number 7001035870 Meeting With Bangalore Escorts
Call Girls Horamavu WhatsApp Number 7001035870 Meeting With Bangalore Escorts
 
Sonagachi Call Girls Services 9907093804 @24x7 High Class Babes Here Call Now
Sonagachi Call Girls Services 9907093804 @24x7 High Class Babes Here Call NowSonagachi Call Girls Services 9907093804 @24x7 High Class Babes Here Call Now
Sonagachi Call Girls Services 9907093804 @24x7 High Class Babes Here Call Now
 
VIP Call Girls Indore Kirti 💚😋 9256729539 🚀 Indore Escorts
VIP Call Girls Indore Kirti 💚😋  9256729539 🚀 Indore EscortsVIP Call Girls Indore Kirti 💚😋  9256729539 🚀 Indore Escorts
VIP Call Girls Indore Kirti 💚😋 9256729539 🚀 Indore Escorts
 
Kesar Bagh Call Girl Price 9548273370 , Lucknow Call Girls Service
Kesar Bagh Call Girl Price 9548273370 , Lucknow Call Girls ServiceKesar Bagh Call Girl Price 9548273370 , Lucknow Call Girls Service
Kesar Bagh Call Girl Price 9548273370 , Lucknow Call Girls Service
 
High Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service Jaipur
High Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service JaipurHigh Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service Jaipur
High Profile Call Girls Jaipur Vani 8445551418 Independent Escort Service Jaipur
 
Call Girl Coimbatore Prisha☎️ 8250192130 Independent Escort Service Coimbatore
Call Girl Coimbatore Prisha☎️  8250192130 Independent Escort Service CoimbatoreCall Girl Coimbatore Prisha☎️  8250192130 Independent Escort Service Coimbatore
Call Girl Coimbatore Prisha☎️ 8250192130 Independent Escort Service Coimbatore
 
sauth delhi call girls in Bhajanpura 🔝 9953056974 🔝 escort Service
sauth delhi call girls in Bhajanpura 🔝 9953056974 🔝 escort Servicesauth delhi call girls in Bhajanpura 🔝 9953056974 🔝 escort Service
sauth delhi call girls in Bhajanpura 🔝 9953056974 🔝 escort Service
 
Artifacts in Nuclear Medicine with Identifying and resolving artifacts.
Artifacts in Nuclear Medicine with Identifying and resolving artifacts.Artifacts in Nuclear Medicine with Identifying and resolving artifacts.
Artifacts in Nuclear Medicine with Identifying and resolving artifacts.
 
Call Girl Service Bidadi - For 7001305949 Cheap & Best with original Photos
Call Girl Service Bidadi - For 7001305949 Cheap & Best with original PhotosCall Girl Service Bidadi - For 7001305949 Cheap & Best with original Photos
Call Girl Service Bidadi - For 7001305949 Cheap & Best with original Photos
 
Call Girls Yelahanka Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Yelahanka Just Call 7001305949 Top Class Call Girl Service AvailableCall Girls Yelahanka Just Call 7001305949 Top Class Call Girl Service Available
Call Girls Yelahanka Just Call 7001305949 Top Class Call Girl Service Available
 
Russian Call Girls Chennai Madhuri 9907093804 Independent Call Girls Service ...
Russian Call Girls Chennai Madhuri 9907093804 Independent Call Girls Service ...Russian Call Girls Chennai Madhuri 9907093804 Independent Call Girls Service ...
Russian Call Girls Chennai Madhuri 9907093804 Independent Call Girls Service ...
 
CALL ON ➥9907093804 🔝 Call Girls Baramati ( Pune) Girls Service
CALL ON ➥9907093804 🔝 Call Girls Baramati ( Pune)  Girls ServiceCALL ON ➥9907093804 🔝 Call Girls Baramati ( Pune)  Girls Service
CALL ON ➥9907093804 🔝 Call Girls Baramati ( Pune) Girls Service
 
Russian Call Girls in Pune Riya 9907093804 Short 1500 Night 6000 Best call gi...
Russian Call Girls in Pune Riya 9907093804 Short 1500 Night 6000 Best call gi...Russian Call Girls in Pune Riya 9907093804 Short 1500 Night 6000 Best call gi...
Russian Call Girls in Pune Riya 9907093804 Short 1500 Night 6000 Best call gi...
 
Call Girls Service Chennai Jiya 7001305949 Independent Escort Service Chennai
Call Girls Service Chennai Jiya 7001305949 Independent Escort Service ChennaiCall Girls Service Chennai Jiya 7001305949 Independent Escort Service Chennai
Call Girls Service Chennai Jiya 7001305949 Independent Escort Service Chennai
 
Russian Call Girls in Pune Tanvi 9907093804 Short 1500 Night 6000 Best call g...
Russian Call Girls in Pune Tanvi 9907093804 Short 1500 Night 6000 Best call g...Russian Call Girls in Pune Tanvi 9907093804 Short 1500 Night 6000 Best call g...
Russian Call Girls in Pune Tanvi 9907093804 Short 1500 Night 6000 Best call g...
 
VIP Mumbai Call Girls Hiranandani Gardens Just Call 9920874524 with A/C Room ...
VIP Mumbai Call Girls Hiranandani Gardens Just Call 9920874524 with A/C Room ...VIP Mumbai Call Girls Hiranandani Gardens Just Call 9920874524 with A/C Room ...
VIP Mumbai Call Girls Hiranandani Gardens Just Call 9920874524 with A/C Room ...
 
Russian Call Girl Brookfield - 7001305949 Escorts Service 50% Off with Cash O...
Russian Call Girl Brookfield - 7001305949 Escorts Service 50% Off with Cash O...Russian Call Girl Brookfield - 7001305949 Escorts Service 50% Off with Cash O...
Russian Call Girl Brookfield - 7001305949 Escorts Service 50% Off with Cash O...
 
Low Rate Call Girls Pune Esha 9907093804 Short 1500 Night 6000 Best call girl...
Low Rate Call Girls Pune Esha 9907093804 Short 1500 Night 6000 Best call girl...Low Rate Call Girls Pune Esha 9907093804 Short 1500 Night 6000 Best call girl...
Low Rate Call Girls Pune Esha 9907093804 Short 1500 Night 6000 Best call girl...
 

#OOP_D_ITS - 3rd - Migration From C To C++

  • 1. Migration: C to C++ 09/09/2009 1 Hadziq Fabroyir - Informatics ITS
  • 2. C/C++ Program Structure Operating System void function1() { //... return; } int main() { function1(); function2(); function3(); return 0; } void function2() { //... return; } void function3() { //... return; } Operating System
  • 3. Naming Variable MUST Identifier / variable name can include letters(A-z), digits(0-9), and underscore(_) Identifier starts with letteror underscore Do NOT use keywordsas identifier Identifier in C++ is case-sensitive CONSIDER Usemeaningfullname Limit identifier length up to 31 characters, although it can have length up to 2048 Avoid using identifiers that start with an underscore 09/09/2009 Hadziq Fabroyir - Informatics ITS 3
  • 4. Keywords 09/09/2009 Hadziq Fabroyir - Informatics ITS 4
  • 5. Declaring Variable 09/09/2009 Hadziq Fabroyir - Informatics ITS 5 int value; char[] firstName; Char[] address; int 9ball; long bigInt; System::String full_name; int count!; long class; float a234_djJ_685_abc___;
  • 6. Initializing Variable int value = 0; char[] firstName = “Budi”; long bigInt(100L); System::String^ full_name = “Budi Lagi”; 09/09/2009 Hadziq Fabroyir - Informatics ITS 6
  • 7. Fundamental Data Types 09/09/2009 Hadziq Fabroyir - Informatics ITS 7
  • 8. Literals 09/09/2009 Hadziq Fabroyir - Informatics ITS 8
  • 9. Example of Data Types int main() { char c = 'A'; wchar_t wideChar = L'9'; int i = 123; long l = 10240L; float f = 3.14f; double d = 3.14; bool b = true; return 0; } 09/09/2009 Hadziq Fabroyir - Informatics ITS 9
  • 10. Enumerations Variable with specific sets of values Enum Day {Mon, Tues, Wed, Thurs, Fri, Sat, Sun}; Day today = Mon; Enum Day {Mon = 1, Tues, Wed, Thurs, Fri, Sat, Sun}; Day nextDay = Tues; 09/09/2009 Hadziq Fabroyir - Informatics ITS 10
  • 11. Basic Input/Output Operations int main() { //declare and initialize variables int num1 = 0; int num2 = 0; //getting input from keyboard cin >> num1 >> num2; //output the variables value to command line cout << endl; cout << "Num1 : " << num1 << endl; cout << "Num2 : " << num2; return 0; } 09/09/2009 Hadziq Fabroyir - Informatics ITS 11
  • 12. Escape Sequence 09/09/2009 Hadziq Fabroyir - Informatics ITS 12
  • 13. Basic Operators int main() { int a = 0; int b = 0; int c = 0; c = a + b; c = a - b; c = a * b; c = a / b; c = a % b; a = -b; return 0; } 09/09/2009 Hadziq Fabroyir - Informatics ITS 13
  • 14. Bitwise Operators 09/09/2009 Hadziq Fabroyir - Informatics ITS 14 & bitwise AND ~ bitwise NOT | bitwise OR ^ bitwise XOR >>shift right <<shift left
  • 15. Increment and Decrement Operators int main() { int a = 0; int b = 0; a++; b--; ++a; ++b; return 0; } 09/09/2009 Hadziq Fabroyir - Informatics ITS 15
  • 16. Shorthand Operators int main() { int a = 0; int b = 0; a += 3; b -= a; a *= 2; b /= 32; a %= b; return 0; } 09/09/2009 Hadziq Fabroyir - Informatics ITS 16
  • 17. Explicit Casting static_cast<the_type_to_convert_to>(expression) (the_type_to_convert_to)expression 09/09/2009 Hadziq Fabroyir - Informatics ITS 17
  • 18. Constant Declaration int main() { const double rollwidth = 21.0; const double rolllength = 12.0*33.0; const double rollarea = rollwidth*rolllength; return 0; } 09/09/2009 Hadziq Fabroyir - Informatics ITS 18
  • 19. Declaring Namespace namespace MyNamespace { // code belongs to myNamespace } namespace OtherNamespace { // code belongs to otherNamespace } 09/09/2009 Hadziq Fabroyir - Informatics ITS 19
  • 20. Using Namespace #include <iostream> namespace myStuff { int value = 0; } int main() { std::cout << “enter an integer: “; std::cin >> myStuff::value; std::cout << “You entered “ << myStuff::value << std:: endl; return 0; } #include <iostream> namespace myStuff { int value = 0; } using namespace myStuff; int main() { std::cout << “enter an integer: “; std::cin >> value; std::cout << “You entered “ << value<< std:: endl; return 0; } 09/09/2009 Hadziq Fabroyir - Informatics ITS 20
  • 21. Visual C++ Programming Environment Hadziq Fabroyir - Informatics ITS ISO/ANSI C++ (unmanaged) C++/CLI .NET Framework Managed C++ Native C++ Framework Classes Native C++ MFC Common Language Runtime (CLR) Operating System HHardware 09/09/2009 21
  • 22. C++/CLI Data Types 09/09/2009 Hadziq Fabroyir - Informatics ITS 22
  • 23. ITC1398 Introduction to Programming Chapter 3 23 Control Structures Three control structures Sequence structure Programs executed sequentially by default Selection structures if, if…else, switch Repetition structures while, do…while, for
  • 24. ITC1398 Introduction to Programming Chapter 3 24 if Selection Statement Choose among alternative courses of action Pseudocode example If student’s grade is greater than or equal to 60 print “Passed” If the condition is true Print statement executes, program continues to next statement If the condition is false Print statement ignored, program continues
  • 25. Activity Diagram 09/09/2009 Hadziq Fabroyir - Informatics ITS 25
  • 26. ITC1398 Introduction to Programming Chapter 3 26 if Selection Statement Translation into C++ if ( grade >= 60 ) cout << "Passed"; Any expression can be used as the condition If it evaluates to zero, it is treated as false If it evaluates to non-zero, it is treated as true
  • 27. ITC1398 Introduction to Programming Chapter 3 27 if…else Double-Selection Statement if Performs action if condition true if…else Performs one action if condition is true, a different action if it is false Pseudocode If student’s grade is greater than or equal to 60 print “Passed”Else print “Failed” C++ code if ( grade >= 60 ) cout << "Passed";else cout << "Failed";
  • 28. Activity Diagram 09/09/2009 Hadziq Fabroyir - Informatics ITS 28
  • 29. ITC1398 Introduction to Programming Chapter 3 29 if…else Double-Selection Statement Ternary conditional operator (?:) Three arguments (condition, value if true, value if false) Code could be written: cout << ( grade >= 60 ? “Passed” : “Failed” ); Condition Value if true Value if false
  • 30. ITC1398 Introduction to Programming Chapter 3 30 if…else Double-Selection Statement Nested if…else statements One inside another, test for multiple cases Once a condition met, other statements are skipped Example If student’s grade is greater than or equal to 90 Print “A” Else If student’s grade is greater than or equal to 80 Print “B” Else If student’s grade is greater than or equal to 70 Print “C” Else If student’s grade is greater than or equal to 60 Print “D” Else Print “F”
  • 31. ITC1398 Introduction to Programming Chapter 3 31 if…else Double-Selection Statement Nested if…else statements (Cont.) Written In C++ if ( studentGrade >= 90 ) cout << "A";elseif (studentGrade >= 80 ) cout << "B";elseif (studentGrade >= 70 ) cout << "C"; elseif ( studentGrade >= 60 ) cout << "D";else cout << "F";
  • 32. while Repetition Statement A repetition statement (also called a looping statement or a loop) allows the programmer to specify that a program should repeat an action while some condition remains true. The pseudocode statement While there are more items on my shopping list Purchase next item and cross it off my list 09/09/2009 Hadziq Fabroyir - Informatics ITS 32
  • 33. for Repetition Statement 09/09/2009 Hadziq Fabroyir - Informatics ITS 33
  • 34. do …while Repetition Statement do { statement } while ( condition ); 09/09/2009 Hadziq Fabroyir - Informatics ITS 34
  • 35. switch Multiple-Selection Statement 09/09/2009 Hadziq Fabroyir - Informatics ITS 35
  • 36. For your practice … Lab Session I (Ahad, 19.00-21.00) 4.14 5.20 6.27 Lab Session II (Senin, 19.00-21.00) 4.35 5.12 6.30 09/09/2009 Hadziq Fabroyir - Informatics ITS 36
  • 37. ☺~ Next: OOP using C++ ~☺ [ 37 ] Hadziq Fabroyir - Informatics ITS 09/09/2009