Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapters 1-5 Review C++ Class. Chapter 1 – the big picture Objects Class Inheritance Reusability Polymorphism and Overloading.

Similar presentations


Presentation on theme: "Chapters 1-5 Review C++ Class. Chapter 1 – the big picture Objects Class Inheritance Reusability Polymorphism and Overloading."— Presentation transcript:

1 Chapters 1-5 Review C++ Class

2 Chapter 1 – the big picture Objects Class Inheritance Reusability Polymorphism and Overloading

3 Chapter 2 – c++ basics Functions Variable Types Integers Characters Escape Sequences Floats Manipulators endl setw Longs Doubles Long Double Unsigned vs. Signed Type Conversion Arithmetic Operators Remainder operator (%) Assignment operators (=, +=, -=, *=, /= %=) Increment operators(++, var = var + inc, var += inc) Prefix and Postfix Decrement operators(--, var = var – inc, var -= inc) Library Functions Header and Library files Two ways to use #include

4 Chapter 3 – Loops and Decisions Relational Operators (,==, =) Loops for loop while loop do loop Decisions if…else statement Nested if…else switch statement break statement continue statement goto statement exit() function getche() function Assignment expression Conditional operator (a<b ? a : b) Logical Operators and (&&) or (||) not (!)

5 Chapter 4 - Structures Structures Simple structure //required includes above struct part { int modelnumber; int partnumber; float cost; }; //main code part part1; part1.modelnumber = 526; part1.partnumber = 373; part1.cost = 217.55; //output info Declaring structure and defining it in structure struct { } part1; Structures within structures Access of nested structures Topstructure.bottomstructur e.bottomstructurevariable = 13; C++ structures can hold functions and data but are usable used only for data Enumerated Data types A finite list of values that the data type can take on enum finitelist { 1, 4, 6, 9 }; finitelist flist1 = 9; finitelist flist2 = 4;

6 Chapter 5 - Functions Simple Functions No return value, use void type Declaration Calling the Function Definition Declaration can be eliminated if the function appears before the first call to the function Passing arguments Passing by value (ie. Copy) Passing by reference Returning Values To return a value, the function must be declared and defined with a value other than void return statement Nested expressions Reference Arguments Indicated by & connected to type definition Overloaded Functions Can have different variable types and different arguments but the same name Inline Functions Puts the function inside the code each time the function is called Default Arguments Enables only part of the arguments to be used, the rest are default. Example Repchar(char=‘*’, int=45); Repchar(); All legal Repchar(‘=’); Repchar(‘+’, 30); Variable storage types Automatic External / Global Static automatic Returning By Reference


Download ppt "Chapters 1-5 Review C++ Class. Chapter 1 – the big picture Objects Class Inheritance Reusability Polymorphism and Overloading."

Similar presentations


Ads by Google