Learning Objectives What else in C++ Bitwise operator

Slides:



Advertisements
Similar presentations
Introduction to C++ An object-oriented language Unit - 01.
Advertisements

Chapter 11 Separate Compilation and Namespaces. Copyright © 2006 Pearson Addison-Wesley. All rights reserved Learning Objectives Separate Compilation.
Copyright © 2002 Pearson Education, Inc. Slide 1.
Chapter 12 Separate Compilation and Namespaces. Abstract Data Type (ADT) ADT: A data type consisting of data and their behavior. The abstraction is that.
Chapter 16 Exception Handling. What is Exception Handling? A method of handling errors that informs the user of the problem and prevents the program from.
1 Lecture 16:User-Definded function I Introduction to Computer Science Spring 2006.
Data Structures (Second Part) Lecture 2 : Pointers Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University.
Exception Handling – illustrated by Java mMIC-SFT November 2003 Anders P. Ravn Aalborg University.
What Data Do We Have? Sections 2.2, 2.5 August 29, 2008.
Chapter 11 Separate Compilation and Namespaces Copyright © 2008 Pearson Addison-Wesley. All rights reserved.
1 Lecture-4 Chapter 2 C++ Syntax and Semantics, and the Program Development Process Dale/Weems/Headington.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 12 Separate Compilation Namespaces Simple Make Files (Ignore all class references.
 2006 Pearson Education, Inc. All rights reserved Midterm review Introduction to Classes and Objects.
CS31: Introduction to Computer Science I Discussion 1A 4/2/2010 Sungwon Yang
Libraries Programs that other people write that help you. #include // enables C++ #include // enables human-readable text #include // enables math functions.
1. 2 FUNCTION INLINE FUNCTION DIFFERENCE BETWEEN FUNCTION AND INLINE FUNCTION CONCLUSION 3.
C++ Functions. 2 Agenda What is a function? What is a function? Types of C++ functions: Types of C++ functions: Standard functions Standard functions.
VARIABLES, TYPES, INPUT/OUTPUT, ASSIGNMENT OPERATION Shieu-Hong Lin MATH/CS Department Chapel.
Agenda Review Compiling Review Data Types Integer Division Composition C++ Mathematical Functions User Input Reading: , 8.11 Homework #3.
CS 192 Lecture 3 Winter 2003 December 5, 2003 Dr. Shafay Shamail.
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
The Structure of a C++ Program. Outline 1. Separate Compilation 2. The # Preprocessor 3. Declarations and Definitions 4. Organizing Decls & Defs into.
By Noorez Kassam Welcome to JNI. Why use JNI ? 1. You already have significantly large and tricky code written in another language and you would rather.
CS 450 MPX P ROJECT A Quick C Review. P OINTERS AND ADDRESSES IN C Check Manual I2 from Dr. Mooney’s website for a complete review of C topics you will.
Lecture 3: The parts of a C++ program Professor: Dr. Miguel Alonso Jr. Fall 2008 CGS2423/COP1220.
COMPUTER PROGRAMMING. A Typical C++ Environment Phases of C++ Programs: 1- Edit 2- Preprocess 3- Compile 4- Link 5- Load 6- Execute Loader Primary Memory.
1 CS161 Introduction to Computer Science Topic #3.
C++ Functions. Objectives 1. Be able to implement C++ functions 2. Be able to share data among functions 2.
Chapter 6 User-Defined Functions I. Objectives Standard (predefined) functions What are they, and How to use them User-Defined Functions Value returning.
L function n predefined, programmer-defined l arguments, (formal) parameters l return value l function call, function invocation l function definition.
1 Chapter 2 C++ Syntax and Semantics, and the Program Development Process.
Lecture 19 CIS 208 Wednesday, April 06, Welcome to C++ Basic program style and I/O Class Creation Templates.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 5P. 1Winter Quarter C Programming Basics Lecture 5.
#include using namespace std; // Declare a function. void check(int, double, double); int main() { check(1, 2.3, 4.56); check(7, 8.9, 10.11); } void check(int.
Introduction to Functions.  A complex problem is often easier to solve by dividing it into several smaller parts, each of which can be solved by itself.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 6: User-Defined Functions I.
Compiler Directives. The C Preprocessor u The C preprocessor (cpp) changes your source code based on instructions, or preprocessor directives, embedded.
1 What is a Named Constant? A named constant is a location in memory that we can refer to by an identifier, and in which a data value that cannot be changed.
Lecture-3 Functions and Recursion. C Preprocessor Includes header files like stdio.h Expands macros defined Handles conditional compilations PreprocessorProcessor.
Separating Class Specification tMyn1 Separating Class Specification from Implementation Usually class declarations are stored in their own header files.
C++ Basics Programming. COMP104 Lecture 5 / Slide 2 Introduction to C++ l C is a programming language developed in the 1970s with the UNIX operating system.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
C++ Namespaces, Exceptions CSci 588: Data Structures, Algorithms and Software Design All material not from online sources copyright © Travis Desell, 2011.
Functions Skill Area 314 Part B. Lecture Overview Functions Function Prototypes Function Definitions Local Variables Global Variables Default Parameters.
Lecture 01d: C++ review Topics: functions scope / lifetime preprocessor directives header files C structures ("simple classes")
FUNCTIONS (C) KHAERONI, M.SI. OBJECTIVE After this topic, students will be able to understand basic concept of user defined function in C++ to declare.
C++ Lesson 1.
Chapter 1.2 Introduction to C++ Programming
LESSON 06.
Andy Wang Object Oriented Programming in C++ COP 3330
Programming with ANSI C ++
Why exception handling in C++?
Object Oriented Programming COP3330 / CGS5409
Separate Compilation and Namespaces
Separate Compilation.
Exceptions with Functions
Chapter 5 Function Basics
FUNCTIONS& FUNCTIONS OVERLOADING
Functions A function is a “pre-packaged” block of code written to perform a well-defined task Why? Code sharing and reusability Reduces errors Write and.
C Preprocessor(CPP).
Andy Wang Object Oriented Programming in C++ COP 3330
CSC 270 – Survey of Programming Languages
Namespaces How Shall I Name Thee?.
C++ Compilation Model C++ is a compiled language
Chapter 6: User-Defined Functions I
Functions Imran Rashid CTO at ManiWeber Technologies.
Using string type variables
What Is? function predefined, programmer-defined
Introduction to Functions
C Language B. DHIVYA 17PCA140 II MCA.
Presentation transcript:

Learning Objectives What else in C++ Bitwise operator Register storage class Conditional compilation Separate compilation Exception handling Namespace

Bitwise Operator Binary Math 0 + 0 = 0 0 + 1 = 1 1 + 1 = 10

Bitwise Operator

Register Storage Class Example register int Miles; Variable Miles is stored in register instead of main memory for quick access

Conditional Compilation You are trying to write a portable program for different compiler, operating system, or computer. Example (delete file): unlink for Unix, remove for regular C library #ifdef Unix unlink(filename); #else remove(filename); #endif

Conditional Compilation Then, you could place the line #define Unix at the top of the file when compiling under an old Unix system

Separate Compilation Divide one program into different header files and source code files As we did in homework and project During compilation, the system will replace #include “xxx.h” with the contents of “xxx.h” Only compile once: save time Also support conditional compilation

Exception handling: Standard approach to handle errors void function_F() { Try <do something> If(error condition) throw exception; } Catch (MyException e) <Handle exception>}

Namespace A namespace is a collection of name definitions, such class definition, variable declarations, and function definitions #include <iostream> using namespace std; Place all the name definitions (for example, cin, cout) into std name space and use this space

Namespace With namespace, you can Redefine the existing names (functions, classes, variables) such as cin, cout You need to create a new space for them Assign one name (function, class, variable) with different definitions You need to create separate spaces for them