Hierarchy of C++ data types. Hierarchy of C++ data types Contd.. Note : The modifies signed, unsigned, long and short may be applied to character and.

Slides:



Advertisements
Similar presentations
Operator Overloading. C++ 2 Outline  General technique  Overloading of the assignment operator  Overloading the increment and decrement operators.
Advertisements

1 9/13/06CS150 Introduction to Computer Science 1 Type Casting.
1 Lecture 7  Fundamental data types in C  Data type conversion:  Automatic  Casting  Character processing  getchar()  putchar()  Macros on ctype.h.
Chapter 4 Control Structures I. Objectives ► Examine relational and logical operators ► Explore how to form and evaluate logical (Boolean) expressions.
True or false A variable of type char can hold the value 301. ( F )
COMP1180 Review Date: 4 March, 2009 Time: 10:30am - 12:20pm Venue: –CS students -- FSC801C and FSC801D –IS and other students -- OEE1017 Remarks: – 1)
Primitive Variable types Basic types –char (single character or ASCII integer value) –int (integer) –short (not longer than int) –long (longer than int)
1 9/17/07CS150 Introduction to Computer Science 1 Type Casting.
Some basic I/O.
CS150 Introduction to Computer Science 1
More on Numerical Computation CS-2301 B-term More on Numerical Computation CS-2301, System Programming for Non-majors (Slides include materials from.
CS 117 Spring 2002 Review for Exam 2 March 6, 2002 open book, 1 page of notes.
General Computer Science for Engineers CISC 106 Lecture 33 Dr. John Cavazos Computer and Information Sciences 05/11/2009.
Primitive Types Java supports two kinds of types of values – objects, and – values of primitive data types variables store – either references to objects.
More about Numerical Computation CS-2301, B-Term More about Numerical Computation CS-2301, System Programming for Non-Majors (Slides include materials.
Chapter 13: Overloading.
JavaServer Pages Syntax Harry Richard Erwin, PhD CSE301/CIT304.
Programming Languages
Operator Overloading and Type Conversions
Imperative Programming Part One. 2 Overview Outline the characteristics of imperative languages Discuss other features of imperative languages that are.
A Variable is symbolic name that can be given different values. Variables are stored in particular places in the computer ‘s memory. When a variable is.
Do … while ( continue_cond ) Syntax: do { stuff you want to happen in the loop } while (continue_condition);
CSCE 121: Introduction to Program Design and Concepts, Honors Dr. J. Michael Moore Spring 2015 Set 3: Objects, Types, and Values 1 Based on slides.
Lecture 4 Introduction to Programming. if ( grade ==‘A’ ) cout
Java ProgrammingtMyn1 Java Programming Timo Mynttinen Mikkeli University of Applied Sciences.
CSCI 3328 Object Oriented Programming in C# Chapter 5: C# Control Statement – Part II UTPA – Fall
CSCI 1100/1202 January 28, The switch Statement The switch statement provides another means to decide which statement to execute next The switch.
Decision II. CSCE 1062 Outline  Boolean expressions  switch statement (section 4.8)
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Chapter 3:Decision Structures.  3.1 The if Statement  3.2 The if-else Statement  3.3 The if-else-if Statement  3.4 Nested if Statements  3.5 Logical.
University of Palestine software engineering department Introduction to data structures Control Statements: Part 1 instructor: Tasneem Darwish.
CS 44001/54001 CS III: Programming Patterns
Chapter 05 (Part III) Control Statements: Part II.
Switch Statements Comparing Exact Values. The Switch Statement: Syntax The switch statement provides another way to decide which statement to execute.
Controlling Program Flow. Data Types and Variable Declarations Controlling Program Flow.
Chapters 1-5 Review C++ Class. Chapter 1 – the big picture Objects Class Inheritance Reusability Polymorphism and Overloading.
C++ Lecture 1 Friday, 4 July History of C++ l Built on top of C l C was developed in early 70s from B and BCPL l Object oriented programming paradigm.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
C++ / G4MICE Course Session 2 Basic C++ types. Control and Looping Functions in C Function/method signatures and scope.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
1 Chapter 3: Loops and Logic. 2 Control Statements If statement Example NumberCheck.java Relational operators (, >=, ==, !=) Using code blocks with If.
A FIRST BOOK OF C++ CHAPTER 5 REPETITION. OBJECTIVES In this chapter, you will learn about: The while Statement Interactive while Loops The for Statement.
A First Book of C++ Chapter 5 Repetition.
Chapter 13: Overloading and Templates. Objectives In this chapter, you will – Learn about overloading – Become familiar with the restrictions on operator.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 8 Java Fundamentals Control Structures Fri.
2: Basics Basics Programming C# © 2003 DevelopMentor, Inc. 12/1/2003.
0 Chap.2. Types, Operators, and Expressions 2.1Variable Names 2.2Data Types and Sizes 2.3Constants 2.4Declarations 2.5Arithmetic Operators 2.6Relational.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 26 Clicker Questions December 3, 2009.
CPS120 Introduction to Computer Science Exam Review Lecture 18.
Session 2 Operators, Decisions and Loops. Objectives Operators Casting data Decision marking structures Loops break, continue, return.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
Chad’s C++ Tutorial Demo Outline. 1. What is C++? C++ is an object-oriented programming (OOP) language that is viewed by many as the best language for.
ECE122 Feb 10, Unary Operator An operator that takes only a single operand Plus: + Minus: – Cast: (type). E.g. (double)
C syntax (simplified) BNF. Program ::= [ ] Directives ::= [ ] ::= | |… ::=#include > ::=#define.
Object Oriented Programming Lecture 2: BallWorld.
1Object-Oriented Program Development Using C++ Built-in Data Types Data type –Range of values –Set of operations on those values Literal: refers to acceptable.
Topics introduced today (these topics would be covered in more detail in later classes) – Primitive Data types Variables Methods “for” loop “if-else” statement.
C++ LANGUAGE MULTIPLE CHOICE QUESTION
C++, OBJECT ORIENTED PROGRAMMING
Expressions and Control Flow in JavaScript
JavaScript: Control Statements I
Chapter 8 JavaScript: Control Statements, Part 2
Variables, Loops, Decision Statements, etc
Structured Program Development in C
More about Numerical Computation
Structured Program Development in C
Chapter 3 Operators and Expressions
2. Second Step for Learning C++ Programming • Data Type • Char • Float
ENERGY 211 / CME 211 Lecture 5 October 1, 2008.
Presentation transcript:

Hierarchy of C++ data types

Hierarchy of C++ data types Contd.. Note : The modifies signed, unsigned, long and short may be applied to character and integer basic data types, long may also be applied to double.

Water-fall Model of type conversion

OPERATOR OVERLOADING means assigning different meaning to an operation depending on the context. e.g. gives the value pointed to by the pointer used for multiplying two numbers The number and type of operands decide the nature of operation to follow.

OPERATOR OVERLOADING Contd.. > are good examples of operator overloading. //display a double type value. cout <<75.86; // displays a string by invoking depth of char type

OPERATOR OVERLOADING Contd.. Note : None of these definitions affect the built-in meaning of the operator. Almost all C++ opeators can be overloaded with a few exceptions such as the member-access operators (- and.*), conditional operator (? :), Scope resolution operator (: :) and the size operator (size of).

OPERATOR OVERLOADING Contd..

Basic Control Structure C++ supports all three basic control structures with the object-oriented paradigm. (C++ combines the power of structured programming with the Object-Oriented paradigm).

The if Statement Simple if if.... else

Form 1 if (expression is true) { action 1, } action 2 ; action 3 ;

Form 2 if (expression is true) { action 1; } else { action 2 ; } action 3 ;

Form 3 Switch (expression) { case 1: { action 1; } case 2: { action 2; }.

Form 3 default : { action n; } action n+1;

LOOPING STATEMENT STRUCTURE do-while Statement While Statement (exit-controlled) (entry-controlled) do While (condition is true) {{ action 1; } while (condition is true); } action 2; action 2;

LOOPING STATEMENT STRUCTURE For statement (entry-controlled) for (initial value; test; increment) { action 1; } action 2;