Dr Ian Reid B4, 4 lectures, Hilary Term

Size: px
Start display at page:

Download "Dr Ian Reid B4, 4 lectures, Hilary Term"

Transcription

1 Software Engineering Dr Ian Reid B4, 4 lectures, Hilary Term

2 Software Engineering vs structured programming Not really a course about software engineering 1. Software engineering Mostly about concepts, 2. Structured programming Revision, coding in C and Matlab, functions 3. Data structures structures, classes 4. Object oriented programming objects, object-oriented concepts like inheritance, polymorphism, patterns and the standard template library

3 Learning Outcomes The course will aim to give a good understanding of basic design methods, and emphasize the need to produce well-structured maintainable computer software. The course will concentrate on principles, but these will be reinforced with examples in Matlab and C/C++ programming languages. Specifically, by the end of the course students should: understand concepts of basic program design techniques that can be applied to a variety of programming languages, in particular Matlab and C/C++ understand the need for structured programming in software projects be able to recognise and to produce and/or maintain well structured programs have a basic understanding of the role of and advantages of object oriented design

4 Texts Sommerville, Software Engineering, Addison-Wesley (8 th edition), Wirth, Algorithms + Data Structures = Programs, Prentice-Hall, 1975 Leveson, Safeware: System Safety and Computers, Addison-Wesley, Lipmann and Lajoie, C++ Primer, Addison-Wesley, Goodrich et al., Data structures and algorithms in C++, Wiley, 2004

5 The Role of Computing in Engineering Computing is ubiquitous in engineering. Why? Awesome speed of modern, everyday computers a makes complicated analysis and simulation possible across all domains. Applications in design and modelling. Far beyond the reach of the mortal human engineer. Indeed many modelling problems are utterly infeasible without modern computers and software. In embedded systems, computers can provide a level of power, speed, flexibility and control not otherwise possible (eg mobile phone) Computing is cheap (but exercise this argument with care) Software is the key some examples

6 Example: mobile phone Even simple mobile phones rely on software Typical phone has a microcontroller (SIM card) with a small program Drive GUI Control devices (keypad, microphone, a/d, dsp, decoder)

7 Example: Sizewell B Nuclear power station (PWR), onstream in 1995 Software used extensively in the design Software for control! first UK reactor to use software in its Primary Protection System)

8 A separate programs There is a software project just to manage all the software! Clearly safetycritical features of the software Example: A380

9 Example: NPfIT NHS National Plan for IT Plan to provide electronic care records for patients Connect GPs and 300 hospitals Provide secure access to records for healthcare professionals Provide access for patients to their own records via Healthspace

10 Software engineering versus programming Software engineering is about more than just programming/coding It is about design principles and methodologies that yield programs that are Robust Manageable Reusable

11 Software vs other engineering How is software engineering similar to other engineering? Abstraction and Modularity Consider free-body diagram Thevenin/Norton Low output impedance / High input impedance Digital computer We return to these concepts later

12 Abstraction: free-body diagram

13 Modularity: Op-amp buffer In + - Out Unity gain buffer Vout = Vin Very high input impedance, very low output impedance

14 Software vs other engineering How is software different to other engineering? Pure, weightless, flexible Capacity to incorporate massive complexity No manufacturing defects, corrosion, aging

15 Intrinsic difficulties with software Analogue versus discrete state systems The curse of flexibility Can encourage unnecessary complexity Redefinition of tasks late in development shifting goal-post Complexity and invisible interfaces Standard way of dealing with complexity is via modularity But this alone is not enough because interfaces can be subtle and invisible, and here too there is a need to control complexity Historical usage information Unlike physical systems, there is a limited amount of experience about standard designs

16 When software projects go wrong A320, Habsheim and Strasbourg

17 When software projects go wrong London Ambulance Service 1992, computerised ambulance despatch system fails Therac-25 2 people died and several others exposed to dangerous levels of radiation because of software flaws in radiotherapy device OSIRIS 5M University financial package Expenditure to date more like 20-25M NPfIT? NHS 12 billion IT project comp.risks is a great source of others...

18 NHS National programme for IT: NPfIT Plan to provide electronic care records for patients Connect GPs and 300 hospitals Provide secure access to records for healthcare professionals Provide access for patients to their own records via Healthspace Laudable? Realistic? Software Engineering specialists have their doubts Ross Anderson (Prof of Security Engineering, Cambridge Computing Laboratory) wrtes in his blog I fear the whole project will just continue on its slow slide towards becoming the biggest IT disaster ever.

19 Software life-cycle Software development stages Specification Design Implementation Integration Validation Operation/Maintenance/Evolution Different types of system organise these generic activities in different ways Waterfall approach treats them as distinct stages to be signed off chronologically In practice usually an iteration of various steps

20 Requirements Vague initial goals Iterative refinement Leading to more precise specification Example Calculate the n-bounce trajectory of a lossy bouncing ball. Refine this to consider What does the statement actually mean? Physics Initial conditions Air-resistance? Stopping criterion (criteria)? Now, think about how to design/implement

21 Validation/Verification Verification: does the system confirm to spec? Validation: does it actually do what it was supposed to? Top-down vs bottom-up testing Black-box vs white-box testing Impossibility of exhaustive testing

22 Extreme programming (XP) Proposed in the late 90s as a reaction to problems with traditional development processes Takes extreme position compared with waterfall approach Appropriate for small-medium sized projects Teams of pairs of programmer, programming together Incremental development, frequent system releases Code constantly refined, improved, made as simple as possible Do not design for change; instead change reactively

23 Top down design Here want to keep in mind the general principles Abstraction Modularity Architectural design: identifying the building blocks Abstract specification: describe the data/functions and their constraints Interfaces: define how the modules fit together Component design: recursively design each block

24 Modular design Algorithms Data structures Programs Procedural programming: focus on algorithms Object-oriented programming: focus on data structures

25 Structured programming Top-down vs bottom-up Both are useful as a means to understand the relations between high-level and low-level views of a program Top-down Code high level parts using stubs with assumed functionality for low-level dependencies Iteratively descend to lower-level modules Bottom-up Code and test each low-level component Need test harness so that low-level can be tested in its correct context Integrate components Not hard-fast rules; combination often best

26 Simple design tools Flow chart Pseudo-code Wait for alarm Count = 1 While (not ready to get up and count <= 3) Hit snooze button Increment count Climb out of bed

27 Data flows Data flow diagram Simple example, VTOL simulator Controller state thrust Simulator state Display

28 State diagram Simple design tools

29 Basic coding techniques Pretty much any program can be specified using: Sequences of instructions { Do A; Do B; Do C } Conditional instructions If (condition) Do A Repetitions (loops) While (condition) Do A These semantic concepts are implemented in different high-level programming languages using different syntax

30 Implementation in Matlab and C N= 10; tot = 0; totsq = 0; for i=1:n tot = tot+i; totsq = totsq+i^2; end tot totsq int i; int tot = 0; int totsq = 0; for (i=1; i<n; i++) { tot += i; totsq += i*i; } cout << tot << endl; cout << totsq << endl;

31 Notes on coding style Use meaningful variable names Use comments to supplement the meaning Indent code for each block/loop Encapsulate groups of statements sensibly in functions Encapsulate related data sensibly in data structures Design top down Code bottom-up or top-down, or a combination

32 Matlab vs C Matlab and C are both procedural languages Matlab is an interpreted language each statement decoded and executed in turn C is a compiled language each module (.c file) is converted into assembly language The interfaces between the modules are Shared global data Function calls from one module to another This is resolved at link time when the modules are linked together into an executable

33 Procedural programming Aim is to break program down into functional units procedures or functions Set of inputs, set of outputs In Matlab and C this procedural building block is the function Understanding functions

34 Organisation of Matlab programs A Matlab program may be a script or function i.e. a sequence of instructions This script or function will typically call a bunch of other functions Functions are stored in.m files Multiple functions can be stored in one.m file, but only first is visible outside The others are local functions Part of the recursive subdivision of the problem

35 Matlab file organisation FUNC.m foo.m bar.m FUNC foo bar

36 Organisation of C programs Source code.c.cc Source code.c.cc.. compilation compilation Object file.o Object file.o.. linking executable

37 Functions Function definition Function call Function prototype Scope (local versus global data) Parameters and return value(s) Function call Low-level implementation of function calls Recursion

38 Function definition % compute factorial function z = fact(n) % function body z = 1; for i=1:n z = z*i; end // compute factorial int fact(int n) { int i, val = 1; for (i=1; i<=n; i++) { val *= i; } return val; }

39 Function call Distinguish between The function definition Defines the set of operations that will be executed when the function is called fact(10) The inputs The outputs And the function call i.e. actually using the function a = 6; z = fact(a); Formal vs Actual parameters [V,D] = eig(a); Return value(s) The value of a function evaluation is the return value

40 Function prototype The function prototype provides enough information to the compiler so that it can check that it is being called correctly Defines the interface Input (parameter), output (return value) myexp.h file myexp.c file float myexp(float x); float myexp(float x) { const float precision = 1.0e-6; float term=1.0, res=0.0; int i=0; while (fabs(term)>precision) { res += term; i++; term = pow(x,i)/fact(i); } return res; }

41 Scope: local variables Variables which are declared inside a function are local variables They cannot be seen outside the function (block) in which they are declared A local variable exists only for the duration of the current function execution It is declared as a new variable every time the function is called It ceases to exist when the function returns It does not remember its value between calls

42 Scope: global variables Global variables exist outside all functions A global variable is visible inside functions If there exist two variables, one local, one global, with the same name, then the local one takes precedence within its local scope C and Matlab behave differently C will use a global if no local exists Matlab only uses a global if the programmer explicitly requests it Globals should be used with caution because their use inside a function compromises its encapsulation

43 Encapsulation Want the function to behave in the same way for the same inputs encapsulate particular functional relationship But if the function depends on a global it could behave differently for the same inputs Live example using myexp

44 Function encapsulation Input parameters Output values Hidden input Input parameters Output values Hidden output

45 Side-effects effects Could set value of a global variable in a function Again this compromises the function s encapsulation Causes a side-effect An implicit output, not captured by the interface Makes it difficult to re-use code with confidence c.f. C and Matlab function libraries Set of re-usable routines with well defined interfaces In small projects maybe not a big problem Hugely problematic in bigger projects, especially when multiple programmers working as a team Complicates interfaces between components, possibly in unintended ways

46 Low-level implementation of function call Memory CODE machine code DATA STACK global variables Activation record local variable m local variable 1 return location parameter x parameter 1 return value n return value 1

47 Pass by value/reference int i=5, j=10; swap(i,j); cout << i << << j << endl; Pass by value void swap(int a, int b) { int temp = a; a = b; b = temp; return; } Pass by reference void swap(int& a, int& b) { int temp = a; a = b; b = temp; return; }

48 Recursion Recursion is the programming analogue of induction: If p(0) and p(n) implies p(n+1) Then p(n) for all n Define a function in terms of Itself Boundary conditions For example Factorial: n! = n * (n-1)!, 0! = 1

49 Live demo Recursion example: factorial

50 Data types and data structures C/C++ predefine a set of atomic types bool, char, int, float, double C/C++ provides machanism for building compound data structures struct (class) Array Matlab supports arrays/matrices (of course) Matlab also supports structures

51 C/C++: struct and class A class (struct in C) is a compound data type which encapsulates related data into a single entity class Complex { public: double re, im; }; Class definition Defines how a variable of this type will look int i; Complex z; Create a variable (an instance) of this type

52 Example: VTOL state Controller state thrust Simulator state Display Represent current state as, say, a triple of numbers and a bool, (position, velocity, mass, landed) Single variable represents all numbers Better abstraction! class State { double pos, vel, mass; bool landed; }; State s;

53 Accessing class members State s; s.pos = 1.0; s.vel = -20.0; s.mass = ; s.landed = false; s.pos = s.pos + s.vel*deltat; Thrust = ComputeThrust(s); In Matlab introduce structure fields without declaration s.pos = 1.0; s.vel = -20.0; Thrust = ComputeThrust(s);

54 Output parameters Image ReadImage(const string filename, bool& flag); bool ReadImage(const string filename, Image& im); Input: filename (type string) Output: im (type Image) boolean flag indicating success/failure function [Image, errflag] = ReadImage(filename) Basically the same, but cleaner in Matlab!

55 Arrays An array is a data structure containing a numbered (indexed) collection of items of a single data type int a[10]; res = a[0] + a[1] + a[2]; Complex z[20]; State s[100]; for (t=1; t<100; t++) { s[t].pos = s[t-1].pos + s[t-1].vel + 0.5*g; s[t].vel = s[t-1].vel + g GetThrust(s[t-1], burnrate)/s[t-1].mass; s[t].mass = s[t-1].mass burnrate*escapevel; }

56 double d[10][5]; has elements: Multi-dimensional arrays d[0][0] d[0][1] d[0][4]... d[9][0] d[9][1] d[9][4]

57 Methods In C++ a class encapsulates related data and functions A class has both data fields and functions that operate on the data A class member function is called a method in the object-oriented programming literature

58 Example class Complex { public: double re, im; double Mag() { return sqrt(re*re + im*im); } }; double Phase() { return atan2(im, re); } Complex z; cout << Magnitude= << z.mag() << endl;

59 Constructor Whenever a variable is created (declared), memory space is allocated for it It might be initialised int i; int i=10; int i(10); In general this is the work of a constructor The constructor is a special function with the same name as the class and no return type Complex(double x, double y) { { re = x; im = y; }

60 Information hiding / encapsulation Principle of encapsulation is that software components hide the internal details of their implementation In procedural programming, treat a function as black boxes with a well-defined interface Need to avoid side-effects Use these functions as building blocks to create programs In object-oriented programming, a class defines a black box data structure, which has Public interface Private data Other software components in the program can only access class through well-defined interface, minimising side-effects

61 Example class Complex { public: Complex(double x, double y) { re=x; im=y; } double Re() { return re; } double Im() { return im; } double Mag() { return sqrt(re*re + im*im);} double Phase() { return atan2(im, re); } }; private: double re, im; Complex z(10.0,8.0); cout << Magnitude= << z.mag() << endl; cout << Real part= << z.re() << endl;

62 Example class Complex { public: Complex(double x, double y) { r = sqrt(x*x + y*y); theta = atan2(y,x); } double Re() { return r*cos(theta); } double Im() { return r*sin(theta); } double Mag() { return r;} double Phase() { return theta; } } }; private: double r, theta; Complex z(10.0,8.0); cout << Magnitude= << z.mag() << endl; cout << Real part= << z.re() << endl;

63 Complex.h C++ program organisation class Complex { public: Complex(double x, double y); double Re(); double Im(); double Mag(); double Phase(); }; private: double re, im;

64 Complex.cpp C++ program organisation #include Complex.h Complex::Complex(double x, double y) { re = x; im = y; } double Complex::Re() { return re; } double Complex::Im() { return im; } double Complex::Mag() { return sqrt(re*re+im*im); } double Complex::Phase() { return atan2(im,re); }

65 Object-oriented programming An object in a programming context is an instance of a class Object-oriented programming concerns itself primarily with the design of classes and the interfaces between these classes The design stage breaks the problem down into classes and their interfaces OOP also includes two important ideas concerned with hierarchies of objects Inheritance polymorphism

66 Inheritance Hierarchical relationships often arise between classes Object-oriented design supports this through inheritance An derived class is one that has the functionality of its parent class but with some extra data or methods In C++ class A : public B { };

67 Example class Window Data: width, height posx, posy Methods: raise(), hide() select(), iconify() class TextWindow Data: cursor_x, cursor_y Methods: redraw(), clear() backspace(), delete() class GraphicsWindow Data: background_colour Methods: redraw(), clear() fill() class InteractiveGraphicsWindow Data: Methods: MouseClick(), MouseDrag()

68 Polymorphism Polymorphism, Greek for many forms One of the most powerful object-oriented concepts Ability to hide alternative implementations behind a common interface Ability of objects of different types to respond in different ways to a similar event Example TextWindow and GraphicsWindow, redraw()

69 Implementation In C++ run-time polymorphism implemented via virtual functions class Window { virtual void redraw(); };

70 Example Class A is base class, B and C both inherit from A If the object is of type A then call A s func() If the object is of type B then call B s func() If the object is of type C then call C s func() If class A defines func() as virtual void func() = 0; then A has no implementation of func() class A is then an abstract base class It is not possible to create an instance of class A, only instances derived classes, B and C class A defines an interface to which all derived classes must conform Use this idea in designing program components Specify interface, then have a guarantee of compatibility of all derived objects

71 Another example Consider a vector graphics drawing package Consider base class Drawable A graphics object that knows how to draw itself on the screen Class hierarchy may comprise lines, curves, points, images, etc Program keeps a list of objects that have been created and on redraw, displays them one by one This is implemented easily by a loop for (int i=0; i<n; i++) { obj[i]->draw(); }

72 Templates Templating is a mechanism in C++ to create classes in which one or more types are parameterised Example of compile-time polymnorphism class BoundedArray { public: float GetElement(int i) { if (i<0 i>=10) { cerr << Access out of bounds\n ; return 0.0; } else { return a[i]; } } private: float a[10]; };

73 Templates template <class Type> class BoundedArray { public: Type GetElement(int i) { if (i<0 i>=10) { cerr << Access out of bounds\n ; return Type(0); } else { return a[i]; } } private: Type a[10]; }; BoundedArray<int> x; BoundedArray<Complex> z;

74 Design patterns Programs regularly employ similar design solutions Idea is to standardise the way these are implemented Code re-use Increased reliability Fewer errors, shorter development time An array is special case of a container type Way of storing a collection of possibly ordered elements. List, stack, queue, double-ended list, etc Templates in C++ offer a way of providing libraries to implement these standard containers

75 Standard Template Library C++ provides a set of container classes Standard way of representing and manipulating container types eg, methods insert(), append(), size(), etc STL supports Stack (FILO structure) List (efficient insertion and deletion, ordered but not indexed) Vector (extendible array) others

76 STL example std::vector<type> is an extendible array It can increase its size as the program needs it to It can be accessed like an ordinary array (eg v[2]) It can report its current size v.size() You can add an item to the end without needing to know how big it is v.push_back(x) #include<vector> int main() { std::vector<int> v; for (int i=0; i<20; i++) v.push_back(i); } for (int i=0; i<v.size(); i++) std::cout << v[i] << std::endl;

77 STL, continued To create a new STL vector of a size specified at runtime int size; std::vector<complex> z; std::cin >> size; z.resize(size); z[5] = Complex(2.0,3.0);

78 STL, continued To create a two dimensional array at run-time int width, height; std::vector< std::vector<int> > x; x.resisze(height); for (int i=0; i<height; i++) x[i].resize(width); x[2][3] = 10;

79 Iterators A standard thing to want to do with a collection of data elements is to iterate over each for (int i=0; i<v.size(); i++) Not all container types support indexing A linked list has order, but only relative order An iterator is a class that supports the standard programming pattern of iterating over a container type std::vector<int> v; std::vector<int>::iterator i; for (it=v.begin(); it!=v.end(); it++) An iterator encapsulates the internal structure of how the iteration occurs

80 Complete example Design a program to compute a maze User-specified size Print it out at the end Algorithm Mark all cells unvisited Choose a start cell While current cell has unvisited neighbours Choose one at random Break wall between it and current cell Recursively enter the chosen cell

81 Design data structures Maze class Compute method Print method Two dimensional array of Cells Cell class Accessor methods Break wall methods Wall flags Visited flag

82 Cell class interface class Cell { public: Cell(); }; bool Visited(); void MarkVisited(); bool BottomWall(); bool RightWall(); void BreakBottom(); void BreakRight(); private: bool bottomwall; bool rightwall; bool visited;

83 Maze class interface class Maze { public: Maze(int width, int height); void Compute(int x, int y); void Print(); private: }; int Rand(int n); int H, W; std::vector< std::vector<cell> > cells;

84 Main program int main(int argc, char* argv[]) { int width, height; cerr << "Enter maze width: "; cin >> width; cerr << "Enter maze height: "; cin >> height; Maze m(width, height); m.compute(height-1,0); m.print(); } return 0;

85 Concept summary Top-down design Abstraction Encapsulation / information hiding Modularity Functions Classes / objects Inheritance Polymorphism Templates Patterns Exam questions? See tute sheet.

B16 Object Oriented Programming

B16 Object Oriented Programming B16 Object Oriented Programming Michael A. Osborne mosb@robots.ox.ac.uk http://www.robots.ox.ac.uk/~mosb/teaching.html#b16 Hilary 2013 This course will introduce object-oriented programming (OOP). It will

More information

C/C++ Coursework Module. Ian Reid, Trinity 2008

C/C++ Coursework Module. Ian Reid, Trinity 2008 C/C++ Coursework Module Ian Reid, Trinity 2008 The course takes you through a series of exercises designed to familiarise you with design and implementation issues in C++ programming. Objectives: Design

More information

C/C++ Coursework Module. Ian Reid, Trinity 2008

C/C++ Coursework Module. Ian Reid, Trinity 2008 C/C++ Coursework Module Ian Reid, Trinity 2008 The course takes you through a series of exercises designed to familiarise you with design and implementation issues in C++ programming. Objectives: Design

More information

B16 Object Oriented Programming

B16 Object Oriented Programming B16 Object Oriented Programming Michael A Osborne mosb@robots.ox.ac.uk http://www.robots.ox.ac.uk/~mosb/b16.html Hilary 2014 Topic 10: Templates Recall our array-bounds-checking class: unfortunately, it

More information

B16 Object Oriented Programming

B16 Object Oriented Programming B16 Object Oriented Programming Michael A. Osborne mosb@robots.ox.ac.uk http://www.robots.ox.ac.uk/~mosb/teaching.html#b16 Hilary 2013 Topic 4: Constructors Recall our definition of the Complex class.

More information

B16 Object Oriented Programming

B16 Object Oriented Programming B16 Object Oriented Programming Michael A Osborne mosb@robots.ox.ac.uk http://www.robots.ox.ac.uk/~mosb/b16.html Hilary 2014 Topic 4: Constructors Recall our definition of the Complex class. class Complex

More information

B16 Object Oriented Programming

B16 Object Oriented Programming B16 Object Oriented Programming Frank Wood fwood@robots.ox.ac.uk http://www.robots.ox.ac.uk/~fwood/teaching/ Hilary 2015 This course will introduce object-oriented programming (OOP). It will introduce

More information

B16 Object Oriented Programming

B16 Object Oriented Programming B16 Object Oriented Programming Frank Wood fwood@robots.ox.ac.uk http://www.robots.ox.ac.uk/~fwood/teaching/ Hilary 2015 This course will introduce object-oriented programming (OOP). It will introduce

More information

Lipmann and Lajoie, and Goodrich et al, are C++ text books that give a general introduction as well as covering some of he more advanced topics.

Lipmann and Lajoie, and Goodrich et al, are C++ text books that give a general introduction as well as covering some of he more advanced topics. 1 2 3 Lipmann and Lajoie, and Goodrich et al, are C++ text books that give a general introduction as well as covering some of he more advanced topics. The C++ bible is by Stroustrup. Meyers is not a textbook.

More information

B16 Object Oriented Programming

B16 Object Oriented Programming B16 Object Oriented Programming Michael A Osborne mosb@robots.ox.ac.uk http://www.robots.ox.ac.uk/~mosb/b16.html Hilary 2014 Topic 7: A Complete Complex Example Let s bring it all together by creating

More information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. 9 Self-Test Exercises p. 11 History Note p. 12 Programming and

More information

Problem Solving with C++

Problem Solving with C++ GLOBAL EDITION Problem Solving with C++ NINTH EDITION Walter Savitch Kendrick Mock Ninth Edition PROBLEM SOLVING with C++ Problem Solving with C++, Global Edition Cover Title Copyright Contents Chapter

More information

CE221 Programming in C++ Part 1 Introduction

CE221 Programming in C++ Part 1 Introduction CE221 Programming in C++ Part 1 Introduction 06/10/2017 CE221 Part 1 1 Module Schedule There are two lectures (Monday 13.00-13.50 and Tuesday 11.00-11.50) each week in the autumn term, and a 2-hour lab

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

CE221 Programming in C++ Part 2 References and Pointers, Arrays and Strings

CE221 Programming in C++ Part 2 References and Pointers, Arrays and Strings CE221 Programming in C++ Part 2 References and Pointers, Arrays and Strings 19/10/2017 CE221 Part 2 1 Variables and References 1 In Java a variable of primitive type is associated with a memory location

More information

2. COURSE DESIGNATION: 3. COURSE DESCRIPTIONS:

2. COURSE DESIGNATION: 3. COURSE DESCRIPTIONS: College of San Mateo Official Course Outline 1. COURSE ID: CIS 278 TITLE: (CS1) Programming Methods: C++ C-ID: COMP 122 Units: 4.0 units Hours/Semester: 48.0-54.0 Lecture hours; 48.0-54.0 Lab hours; and

More information

What are the characteristics of Object Oriented programming language?

What are the characteristics of Object Oriented programming language? What are the various elements of OOP? Following are the various elements of OOP:- Class:- A class is a collection of data and the various operations that can be performed on that data. Object- This is

More information

AN OVERVIEW OF C++ 1

AN OVERVIEW OF C++ 1 AN OVERVIEW OF C++ 1 OBJECTIVES Introduction What is object-oriented programming? Two versions of C++ C++ console I/O C++ comments Classes: A first look Some differences between C and C++ Introducing function

More information

Functions, Pointers, and the Basics of C++ Classes

Functions, Pointers, and the Basics of C++ Classes Functions, Pointers, and the Basics of C++ Classes William E. Skeith III Functions in C++ Vocabulary You should be familiar with all of the following terms already, but if not, you will be after today.

More information

Instantiation of Template class

Instantiation of Template class Class Templates Templates are like advanced macros. They are useful for building new classes that depend on already existing user defined classes or built-in types. Example: stack of int or stack of double

More information

Chapter 1: Object-Oriented Programming Using C++

Chapter 1: Object-Oriented Programming Using C++ Chapter 1: Object-Oriented Programming Using C++ Objectives Looking ahead in this chapter, we ll consider: Abstract Data Types Encapsulation Inheritance Pointers Polymorphism Data Structures and Algorithms

More information

Evolution of Programming Languages

Evolution of Programming Languages Evolution of Programming Languages 40's machine level raw binary 50's assembly language names for instructions and addresses very specific to each machine 60's high-level languages: Fortran, Cobol, Algol,

More information

Fast Introduction to Object Oriented Programming and C++

Fast Introduction to Object Oriented Programming and C++ Fast Introduction to Object Oriented Programming and C++ Daniel G. Aliaga Note: a compilation of slides from Jacques de Wet, Ohio State University, Chad Willwerth, and Daniel Aliaga. Outline Programming

More information

- HALF YEARLY EXAM ANSWER KEY DEC-2016 COMPUTER SCIENCE ENGLISH MEDIUM

- HALF YEARLY EXAM ANSWER KEY DEC-2016 COMPUTER SCIENCE ENGLISH MEDIUM www.padasalai.net - HALF YEARLY EXAM ANSWER KEY DEC-2016 COMPUTER SCIENCE ENGLISH MEDIUM 1 A 26 D 51 C 2 C 27 D 52 D 3 C 28 C 53 B 4 A 29 B 54 D 5 B 30 B 55 B 6 A 31 C 56 A 7 B 32 C 57 D 8 C 33 B 58 C

More information

COP 3330 Final Exam Review

COP 3330 Final Exam Review COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time

More information

G52CPP C++ Programming Lecture 9

G52CPP C++ Programming Lecture 9 G52CPP C++ Programming Lecture 9 Dr Jason Atkin http://www.cs.nott.ac.uk/~jaa/cpp/ g52cpp.html 1 Last lecture const Constants, including pointers The C pre-processor And macros Compiling and linking And

More information

Object Oriented Paradigm

Object Oriented Paradigm Object Oriented Paradigm History Simula 67 A Simulation Language 1967 (Algol 60 based) Smalltalk OO Language 1972 (1 st version) 1980 (standard) Background Ideas Record + code OBJECT (attributes + methods)

More information

(5-1) Object-Oriented Programming (OOP) and C++ Instructor - Andrew S. O Fallon CptS 122 (February 4, 2019) Washington State University

(5-1) Object-Oriented Programming (OOP) and C++ Instructor - Andrew S. O Fallon CptS 122 (February 4, 2019) Washington State University (5-1) Object-Oriented Programming (OOP) and C++ Instructor - Andrew S. O Fallon CptS 122 (February 4, 2019) Washington State University Key Concepts 2 Object-Oriented Design Object-Oriented Programming

More information

C++ (Non for C Programmer) (BT307) 40 Hours

C++ (Non for C Programmer) (BT307) 40 Hours C++ (Non for C Programmer) (BT307) 40 Hours Overview C++ is undoubtedly one of the most widely used programming language for implementing object-oriented systems. The C++ language is based on the popular

More information

CENG 447/547 Embedded and Real-Time Systems. Review of C coding and Soft Eng Concepts

CENG 447/547 Embedded and Real-Time Systems. Review of C coding and Soft Eng Concepts CENG 447/547 Embedded and Real-Time Systems Review of C coding and Soft Eng Concepts Recall (C-style coding syntax) ; - Indicate the end of an expression {} - Used to delineate when a sequence of elements

More information

Computer Science II Lecture 1 Introduction and Background

Computer Science II Lecture 1 Introduction and Background Computer Science II Lecture 1 Introduction and Background Discussion of Syllabus Instructor, TAs, office hours Course web site, http://www.cs.rpi.edu/courses/fall04/cs2, will be up soon Course emphasis,

More information

Chapter 6. Object- Oriented Programming Part II

Chapter 6. Object- Oriented Programming Part II Chapter 6 Object- Oriented Programming Part II 6: Preview issues surrounding the object creational process the Abstract Factory design pattern private and protected inheritance multiple inheritance comparison

More information

Chapter 6 Introduction to Defining Classes

Chapter 6 Introduction to Defining Classes Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of

More information

CHAPTER 4 FUNCTIONS. 4.1 Introduction

CHAPTER 4 FUNCTIONS. 4.1 Introduction CHAPTER 4 FUNCTIONS 4.1 Introduction Functions are the building blocks of C++ programs. Functions are also the executable segments in a program. The starting point for the execution of a program is main

More information

CSCI-1200 Data Structures Spring 2018 Lecture 14 Associative Containers (Maps), Part 1 (and Problem Solving Too)

CSCI-1200 Data Structures Spring 2018 Lecture 14 Associative Containers (Maps), Part 1 (and Problem Solving Too) CSCI-1200 Data Structures Spring 2018 Lecture 14 Associative Containers (Maps), Part 1 (and Problem Solving Too) HW6 NOTE: Do not use the STL map or STL pair for HW6. (It s okay to use them for the contest.)

More information

CPSC 427: Object-Oriented Programming

CPSC 427: Object-Oriented Programming CPSC 427: Object-Oriented Programming Michael J. Fischer Lecture 22 November 28, 2016 CPSC 427, Lecture 22 1/43 Exceptions (continued) Code Reuse Linear Containers Ordered Containers Multiple Inheritance

More information

Evaluation Issues in Generic Programming with Inheritance and Templates in C++

Evaluation Issues in Generic Programming with Inheritance and Templates in C++ Evaluation Issues in Generic Programming with Inheritance and Templates in C++ Emil Vassev, Joey Paquet Department of Computer Science and Software Engineering Concordia University Montreal, Quebec, H3G

More information

Part X. Advanced C ++

Part X. Advanced C ++ Part X Advanced C ++ topics Philip Blakely (LSC) Advanced C++ 158 / 217 References The following are highly regarded books. They are fairly in-depth, and I haven t read them in their entirity. However,

More information

C++ Programming Fundamentals

C++ Programming Fundamentals C++ Programming Fundamentals 269 Elvis C. Foster Lecture 11: Templates One of the contemporary sophistries of C++ programming is defining and manipulating templates. This lecture focuses on this topic.

More information

G52CPP C++ Programming Lecture 7. Dr Jason Atkin

G52CPP C++ Programming Lecture 7. Dr Jason Atkin G52CPP C++ Programming Lecture 7 Dr Jason Atkin 1 This lecture classes (and C++ structs) Member functions inline functions 2 Last lecture: predict the sizes 3 #pragma pack(1) #include struct A

More information

CSCI-1200 Data Structures Fall 2017 Lecture 5 Pointers, Arrays, & Pointer Arithmetic

CSCI-1200 Data Structures Fall 2017 Lecture 5 Pointers, Arrays, & Pointer Arithmetic CSCI-1200 Data Structures Fall 2017 Lecture 5 Pointers, Arrays, & Pointer Arithmetic Review from Letctures 3 & 4 C++ class syntax, designing classes, classes vs. structs; Passing comparison functions to

More information

QUIZ. What is wrong with this code that uses default arguments?

QUIZ. What is wrong with this code that uses default arguments? QUIZ What is wrong with this code that uses default arguments? Solution The value of the default argument should be placed in either declaration or definition, not both! QUIZ What is wrong with this code

More information

CSE 374 Programming Concepts & Tools. Hal Perkins Fall 2015 Lecture 19 Introduction to C++

CSE 374 Programming Concepts & Tools. Hal Perkins Fall 2015 Lecture 19 Introduction to C++ CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 19 Introduction to C++ C++ C++ is an enormous language: All of C Classes and objects (kind of like Java, some crucial differences) Many

More information

Where do we go from here?

Where do we go from here? Where do we go from here? C++ classes and objects, with all the moving parts visible operator overloading templates, STL, standards, Java components, collections, generics language and performance comparisons

More information

CSE 333 Lecture 9 - intro to C++

CSE 333 Lecture 9 - intro to C++ CSE 333 Lecture 9 - intro to C++ Hal Perkins Department of Computer Science & Engineering University of Washington Administrivia & Agenda Main topic: Intro to C++ But first: Some hints on HW2 Labs: The

More information

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 Instructor: K. S. Booth Time: 70 minutes (one hour ten minutes)

More information

Introduction to Programming using C++

Introduction to Programming using C++ Introduction to Programming using C++ Lecture One: Getting Started Carl Gwilliam gwilliam@hep.ph.liv.ac.uk http://hep.ph.liv.ac.uk/~gwilliam/cppcourse Course Prerequisites What you should already know

More information

ECE 449 OOP and Computer Simulation Lecture 11 Design Patterns

ECE 449 OOP and Computer Simulation Lecture 11 Design Patterns ECE 449 Object-Oriented Programming and Computer Simulation, Fall 2017, Dept. of ECE, IIT 1/60 ECE 449 OOP and Computer Simulation Lecture 11 Design Patterns Professor Jia Wang Department of Electrical

More information

Introduction to Programming I COS1511 School of Computing Revision Notes

Introduction to Programming I COS1511 School of Computing Revision Notes Introduction to Programming I COS1511 School of Computing Revision Notes UNISA 2018 1 Introduction Some key basic principles to remember: Apply the BODMAS rules of Mathematics for all calculations; The

More information

Lecture 15 Software Testing

Lecture 15 Software Testing Lecture 15 Software Testing Includes slides from the companion website for Sommerville, Software Engineering, 10/e. Pearson Higher Education, 2016. All rights reserved. Used with permission. Topics covered

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Software Development with C++ Templates

Software Development with C++ Templates Software Development with C++ Templates Lab Submission 1 Exercises should be solved in groups of two. However, with approval from the lecturer, exercises may also be solved alone or in groups of three.

More information

C++ Programming for Non-C Programmers. Supplement

C++ Programming for Non-C Programmers. Supplement C++ Programming for Non-C Programmers Supplement C++ Programming for Non-C Programmers C++ Programming for Non-C Programmers Published by ITCourseware, 7245 S. Havana St, Suite 100, Centennial, CO 80112

More information

CSE 303: Concepts and Tools for Software Development

CSE 303: Concepts and Tools for Software Development CSE 303: Concepts and Tools for Software Development Hal Perkins Autumn 2008 Lecture 24 Introduction to C++ CSE303 Autumn 2008, Lecture 24 1 C++ C++ is an enormous language: All of C Classes and objects

More information

Lecture 2, September 4

Lecture 2, September 4 Lecture 2, September 4 Intro to C/C++ Instructor: Prashant Shenoy, TA: Shashi Singh 1 Introduction C++ is an object-oriented language and is one of the most frequently used languages for development due

More information

Compulsory course in Computer Science

Compulsory course in Computer Science Compulsory course in Computer Science University of Macau Faculty of Science and Technology Department of Computer and Information Science SFTW241 Programming Languages Architecture I Syllabus 2 nd Semester

More information

Cpt S 122 Data Structures. Course Review Midterm Exam # 2

Cpt S 122 Data Structures. Course Review Midterm Exam # 2 Cpt S 122 Data Structures Course Review Midterm Exam # 2 Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Midterm Exam 2 When: Monday (11/05) 12:10 pm -1pm

More information

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++

I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++ No. of Printed Pages : 3 I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination 05723. June, 2015 BCS-031 : PROGRAMMING IN C ++ Time : 3 hours Maximum Marks : 100 (Weightage 75%)

More information

CSCI 102L - Data Structures Midterm Exam #1 Fall 2011

CSCI 102L - Data Structures Midterm Exam #1 Fall 2011 Print Your Name: Page 1 of 8 Signature: Aludra Loginname: CSCI 102L - Data Structures Midterm Exam #1 Fall 2011 (10:00am - 11:12am, Wednesday, October 5) Instructor: Bill Cheng Problems Problem #1 (24

More information

Learning outcomes. Systems Engineering. Debugging Process. Debugging Process. Review

Learning outcomes. Systems Engineering. Debugging Process. Debugging Process. Review Systems Engineering Lecture 9 System Verification II Dr. Joanna Bryson Dr. Leon Watts University of Bath Department of Computer Science 1 Learning outcomes After both lectures and doing the reading, you

More information

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object CHAPTER 1 Introduction to Computers and Programming 1 1.1 Why Program? 1 1.2 Computer Systems: Hardware and Software 2 1.3 Programs and Programming Languages 8 1.4 What is a Program Made of? 14 1.5 Input,

More information

AP Computer Science A Syllabus

AP Computer Science A Syllabus AP Computer Science A Syllabus Course Overview The focus of this class is structured logic with an emphasis on developing simple, elegant algorithms and thinking in an object-oriented manner. The Java

More information

PHY4321 Summary Notes

PHY4321 Summary Notes PHY4321 Summary Notes The next few pages contain some helpful notes that summarize some of the more useful material from the lecture notes. Be aware, though, that this is not a complete set and doesn t

More information

Unit 1 : Principles of object oriented programming

Unit 1 : Principles of object oriented programming Unit 1 : Principles of object oriented programming Difference Between Procedure Oriented Programming (POP) & Object Oriented Programming (OOP) Divided Into Importance Procedure Oriented Programming In

More information

Introduction to C++ (Extensions to C)

Introduction to C++ (Extensions to C) Introduction to C++ (Extensions to C) C is purely procedural, with no objects, classes or inheritance. C++ is a hybrid of C with OOP! The most significant extensions to C are: much stronger type checking.

More information

CS 376b Computer Vision

CS 376b Computer Vision CS 376b Computer Vision 09 / 25 / 2014 Instructor: Michael Eckmann Today s Topics Questions? / Comments? Enhancing images / masks Cross correlation Convolution C++ Cross-correlation Cross-correlation involves

More information

Object Oriented Software Design II

Object Oriented Software Design II Object Oriented Software Design II Introduction to C++ Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 20, 2012 G. Lipari (Scuola Superiore Sant Anna) C++ Intro February

More information

CSCI-1200 Data Structures Spring 2017 Lecture 5 Pointers, Arrays, Pointer Arithmetic

CSCI-1200 Data Structures Spring 2017 Lecture 5 Pointers, Arrays, Pointer Arithmetic CSCI-1200 Data Structures Spring 2017 Lecture 5 Pointers, Arrays, Pointer Arithmetic Announcements Submitty iclicker registration is still open. Even if you already registered on the iclicker website,

More information

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR 603203 DEPARTMENT OF COMPUTER SCIENCE & APPLICATIONS QUESTION BANK (2017-2018) Course / Branch : M.Sc CST Semester / Year : EVEN / II Subject Name

More information

CompuScholar, Inc. Alignment to Nevada "Computer Science" Course Standards

CompuScholar, Inc. Alignment to Nevada Computer Science Course Standards CompuScholar, Inc. Alignment to Nevada "Computer Science" Course Standards Nevada Course Details: Course Name: Computer Science Primary Cluster: Information and Media Technologies Standards Course Code(s):

More information

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe OBJECT ORIENTED PROGRAMMING USING C++ CSCI 5448- Object Oriented Analysis and Design By Manali Torpe Fundamentals of OOP Class Object Encapsulation Abstraction Inheritance Polymorphism Reusability C++

More information

Pointers and References

Pointers and References Steven Zeil October 2, 2013 Contents 1 References 2 2 Pointers 8 21 Working with Pointers 8 211 Memory and C++ Programs 11 212 Allocating Data 15 22 Pointers Can Be Dangerous 17 3 The Secret World of Pointers

More information

Computer Science II Lecture 2 Strings, Vectors and Recursion

Computer Science II Lecture 2 Strings, Vectors and Recursion 1 Overview of Lecture 2 Computer Science II Lecture 2 Strings, Vectors and Recursion The following topics will be covered quickly strings vectors as smart arrays Basic recursion Mostly, these are assumed

More information

C++ Programming for Non-C Programmers. Supplement

C++ Programming for Non-C Programmers. Supplement C++ Programming for Non-C Programmers Supplement ii C++ Programming for Non-C Programmers C++ Programming for Non-C Programmers Published by itcourseware, 10333 E. Dry Creek Rd., Suite 150, Englewood,

More information

PIC 10A. Final Review: Part I

PIC 10A. Final Review: Part I PIC 10A Final Review: Part I Final exam The final exam is worth 30% of your grade, same weight as 2 midterms. Could be 50% if grading option 2 turns out better for you. Length is also roughly 2 midterms

More information

Introduction to C++ Introduction to C++ Dr Alex Martin 2013 Slide 1

Introduction to C++ Introduction to C++ Dr Alex Martin 2013 Slide 1 Introduction to C++ Introduction to C++ Dr Alex Martin 2013 Slide 1 Inheritance Consider a new type Square. Following how we declarations for the Rectangle and Circle classes we could declare it as follows:

More information

CSE 333. Lecture 9 - intro to C++ Hal Perkins Department of Computer Science & Engineering University of Washington

CSE 333. Lecture 9 - intro to C++ Hal Perkins Department of Computer Science & Engineering University of Washington CSE 333 Lecture 9 - intro to C++ Hal Perkins Department of Computer Science & Engineering University of Washington Administrivia New exercise posted yesterday afternoon, due Monday morning - Read a directory

More information

Increases Program Structure which results in greater reliability. Polymorphism

Increases Program Structure which results in greater reliability. Polymorphism UNIT 4 C++ Inheritance What is Inheritance? Inheritance is the process by which new classes called derived classes are created from existing classes called base classes. The derived classes have all the

More information

Final CSE 131B Spring 2004

Final CSE 131B Spring 2004 Login name Signature Name Student ID Final CSE 131B Spring 2004 Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 (25 points) (24 points) (32 points) (24 points) (28 points) (26 points) (22 points)

More information

Fundamentals of Structured Programming

Fundamentals of Structured Programming Fundamentals of Structured Programming Dr. Salma Hamdy s.hamdy@cis.asu.edu.eg 1 Course Logistics Staff Teachers Prof. Mohamed Roushdy (Dean) Dr. Salma Hamdy Contact: s.hamdy@cis.asu.edu.eg Office: FCIS,

More information

Review sheet for Final Exam (List of objectives for this course)

Review sheet for Final Exam (List of objectives for this course) Review sheet for Final Exam (List of objectives for this course) Please be sure to see other review sheets for this semester Please be sure to review tests from this semester Week 1 Introduction Chapter

More information

Verification and Validation. Assuring that a software system meets a user s needs. Verification vs Validation. The V & V Process

Verification and Validation. Assuring that a software system meets a user s needs. Verification vs Validation. The V & V Process Verification and Validation Assuring that a software system meets a user s needs Ian Sommerville 1995/2000 (Modified by Spiros Mancoridis 1999) Software Engineering, 6th edition. Chapters 19,20 Slide 1

More information

CS24 Week 3 Lecture 1

CS24 Week 3 Lecture 1 CS24 Week 3 Lecture 1 Kyle Dewey Overview Some minor C++ points ADT Review Object-oriented Programming C++ Classes Constructors Destructors More minor Points (if time) Key Minor Points const Motivation

More information

STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING

STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING OBJECT ORIENTED PROGRAMMING STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING 1. Object Oriented Programming Paradigms 2. Comparison of Programming Paradigms 3. Basic Object Oriented Programming

More information

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++ Introduction to Programming in C++ Course Text Programming in C++, Zyante, Fall 2013 edition. Course book provided along with the course. Course Description This course introduces programming in C++ and

More information

Note 12/1/ Review of Inheritance Practice: Please write down 10 most important facts you know about inheritance...

Note 12/1/ Review of Inheritance Practice: Please write down 10 most important facts you know about inheritance... CISC 2000 Computer Science II Fall, 2014 Note 12/1/2014 1 Review of Inheritance Practice: Please write down 10 most important facts you know about inheritance... (a) What s the purpose of inheritance?

More information

Supporting Class / C++ Lecture Notes

Supporting Class / C++ Lecture Notes Goal Supporting Class / C++ Lecture Notes You started with an understanding of how to write Java programs. This course is about explaining the path from Java to executing programs. We proceeded in a mostly

More information

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures

Agenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures The main body and cout Agenda 1 Fundamental data types Declarations and definitions Control structures References, pass-by-value vs pass-by-references The main body and cout 2 C++ IS AN OO EXTENSION OF

More information

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK B.E. - Electrical and Electronics Engineering IV SEMESTER CS6456 - OBJECT ORIENTED

More information

Chapter 1 Getting Started

Chapter 1 Getting Started Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different

More information

C++ Basics. Brian A. Malloy. References Data Expressions Control Structures Functions. Slide 1 of 24. Go Back. Full Screen. Quit.

C++ Basics. Brian A. Malloy. References Data Expressions Control Structures Functions. Slide 1 of 24. Go Back. Full Screen. Quit. C++ Basics January 19, 2012 Brian A. Malloy Slide 1 of 24 1. Many find Deitel quintessentially readable; most find Stroustrup inscrutable and overbearing: Slide 2 of 24 1.1. Meyers Texts Two excellent

More information

Lecture Notes on Programming Languages

Lecture Notes on Programming Languages Lecture Notes on Programming Languages 85 Lecture 09: Support for Object-Oriented Programming This lecture discusses how programming languages support object-oriented programming. Topics to be covered

More information

Programmiersprachen (Programming Languages)

Programmiersprachen (Programming Languages) 2016-05-13 Preface Programmiersprachen (Programming Languages) coordinates: lecturer: web: usable for: requirements: No. 185.208, VU, 3 ECTS Franz Puntigam http://www.complang.tuwien.ac.at/franz/ps.html

More information

CSC 533: Organization of Programming Languages. Spring 2005

CSC 533: Organization of Programming Languages. Spring 2005 CSC 533: Organization of Programming Languages Spring 2005 Language features and issues variables & bindings data types primitive complex/structured expressions & assignments control structures subprograms

More information

static CS106L Spring 2009 Handout #21 May 12, 2009 Introduction

static CS106L Spring 2009 Handout #21 May 12, 2009 Introduction CS106L Spring 2009 Handout #21 May 12, 2009 static Introduction Most of the time, you'll design classes so that any two instances of that class are independent. That is, if you have two objects one and

More information

JAVA: A Primer. By: Amrita Rajagopal

JAVA: A Primer. By: Amrita Rajagopal JAVA: A Primer By: Amrita Rajagopal 1 Some facts about JAVA JAVA is an Object Oriented Programming language (OOP) Everything in Java is an object application-- a Java program that executes independently

More information

CSCI-1200 Data Structures Fall 2018 Lecture 3 Classes I

CSCI-1200 Data Structures Fall 2018 Lecture 3 Classes I Review from Lecture 2 CSCI-1200 Data Structures Fall 2018 Lecture 3 Classes I Vectors are dynamically-sized arrays Vectors, strings and other containers should be: passed by reference when they are to

More information

CHAPTER 4 FUNCTIONS. Dr. Shady Yehia Elmashad

CHAPTER 4 FUNCTIONS. Dr. Shady Yehia Elmashad CHAPTER 4 FUNCTIONS Dr. Shady Yehia Elmashad Outline 1. Introduction 2. Program Components in C++ 3. Math Library Functions 4. Functions 5. Function Definitions 6. Function Prototypes 7. Header Files 8.

More information