1. Introduction. 27. Juni 2011

Size: px
Start display at page:

Download "1. Introduction. 27. Juni 2011"

Transcription

1 27. Juni 2011 Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 1 of 41

2 Outline The Course The Motivation The Introduction What is a computer? von-neuman architecture What is a high-level language? bytecode, intermediate languages, and the real world Where does it all come from? historic overview & the software crisis The Development Workflow: Algorithms, Tools, and Activities Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 2 of 41

3 1.1. The Course There ain t no such thing as a free lunch. R. A. Heinlein, The Moon Is a Harsh Mistress Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 3 of 41

4 The Course The Course The Motivation The Speaker Introduction Development Workflow 1.2. The Course Concept Through C/C++ in a rush Programming means training course can t replace it Provide a deeper understanding of underlying mechanisms Three slots a 45 minutes per day Provide some exercises throughout the course lectures Provide some programming support Einfu hrung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 4 of 41

5 Didactic Concept In theory there is no difference between theory and practice. In practice there is. Yogi Berra Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 5 of 41

6 The Course The Course The Motivation The Speaker Introduction Development Workflow After the Course Through C/C++ in a rush Programming means training course can t replace it Provide a deeper understanding of underlying mechanisms Content is tailored to Ph.D. students (not undergrads) Content is aligned with scientific software Three slots a 45 minutes per day Provide some exercises Provide some programming support Temple Church, London Einfu hrung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 6 of 41

7 Calendar From Monday, June 26, till Friday, July 8. Each day three sessions a 45 minutes. We start at 9:30 and end around 12:15. I provide additional programming support each day after the lectures. If I don t stay at the lecture room after the course for the programming support, feel free to write me an (tobias.weinzierl@mytum.de). Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 7 of 41

8 The Guttenberg Slide Martin Fowler: Refactoring Erich Gamma, Richard Helm, Ralph Johnson, John M. Vlissides. Design Patterns: Elements of Reusable Software Randall Hyde: Write Great Code I: Understanding the machine Randall Hyde: Write Great Code II: Thinking Low-level, Writing High-level Scott Meyers. Effective C++ Scott Meyers. More Effective C++ Walter Savitch. Absolute C++ Bjarne Stroustrup. The C++ Programming Language Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 8 of 41

9 1.3. The Motivation... about the Leaning Tower Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 9 of 41

10 The two pillars of science Theory Experiment What happens if these pillars can t be realised or should not be realised? Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 10 of 41

11 The three pillars of science Theory Simulation Experiment Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 11 of 41

12 The Scientific Workflow an Iterative Scheme Numerical Experiments Postprocessing Modelling Numerical Treatment Design of Software Visualisation Tests Implementation Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 12 of 41

13 Scientific Software Crisis PITAC report 2005: Today s CSE ecosystem is unbalanced, with a software base that is inadequate to keep pace with and support evolving hardware and application needs. PITAC report 2005 It is consequently of uttermost importance to have skilled and trained programmers. Programming comprises both a craft and an art, and, hence, coding is not just an unimportant task which can be left to less intelligent henchmen. Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 13 of 41

14 However... PITAC report 2005: Today s CSE ecosystem is unbalanced, with a software base that is inadequate to keep pace with and support evolving hardware and application needs. It is consequently of uttermost importance to have skilled and trained programmers. Programming comprises both a craft and an art, and, hence, coding is not just an unimportant task which can be left to less intelligent henchmen. Almost everybody almost all the time: I agree but in my case it s different. I have better/more urgent things to do than to think about software as, before, I have to understand the underlying physical/technological/medical principles. Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 14 of 41

15 A Success Story Sorry About the Sarcasm Nature 447: In 2006, data from the array led a team of scientists to the surprising conclusion that the world s oceans had cooled during 2003 exceptionally warm years in terms of global surface temperature. The team published its findings in Geophysical Research Letters[1]. Such apparent cooling was seized on by people keen to highlight the uncertainties in forecasts of global warming[2]. That cooling has now been shown to be an artifact. In some of the buoys they are manufactured in separate batches a software glitch caused the temperature and salinity data to be associated with the wrong depths. When the problem data are excluded from the analysis, the cooling trend drops below the level of statistical significance. (pp. 7140) Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 15 of 41

16 Why Matlab sometimes doesn t work Herb Sutter. The free lunch is over: A fundamental turn toward concurrency in software, Dr. Dobb s Journal, 30(3), Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 16 of 41

17 Statements More and more insight will stem from simulations. New insight requires more computing power. More computing power will result from parallelism and other hardware stuff. Mathematicians, engineers, physicians, etc. will write the applications the computer guys write web apps and earn tons of bucks with Google & Co. If you wanna use a tool, you have to learn how to handle it. So learn C/C++/FORTRAN, and, more important, understand what s happening there. Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 17 of 41

18 1.4. The Speaker Excerpt From my CV June 2000-October 2000 October 2000 October 2005 July 2009 October 2009 now July 2011 Work sd&m AG, Munich: Stock exchange (C++) Computer Science at TUM worked at sd&m AG, Munich: Financial services (Java) Hiwi at Chair of Systems & Software Engineering: Übungen zur Einführung in die Informatik (Java) Ph.D. Defense A Framework for Parallel PDE Solvers on Multiscale Adaptive Cartesian Grids (C++) KAUST-TUM Scientific Project Manager Peano framework Software Engineering, coding best practices, and domain-specific languages in High Performance Computing Habil at TUM Lots of HPC software... Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 18 of 41

19 1.5. Introduction A Turing Machine ALU IO Memory If we wanna handle a car/machine (efficiently), we have to know how it works. That doesn t mean that we have to be able to construct a car/machine ourselves. Computer (von-neumann architecture): ALU, Memory, IO Controller, Bus Processor (Very) simple binary operations such as add, increment,... Takes one or two numbers, combines them, and writes back result to memory Has a program counter holding one number Memory Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 19 of 41

20 Memory Processor ALU 21: 22; Memory (Very) simple binary operations such as add, increment,... Takes one or two numbers, combines them, and writes back result to memory Has a program counter holding one number IO 23; 24; 4 25; 5 26; 27; 28: Memory Long linear sequence of post its (storage locations) Sequence of storage locations holds natural numbers Storage locations are enumerated Example: Add entry 24 and entry 25 and write result back to entry 21 Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 20 of 41

21 A First Machine Code Processor ALU 21: 22; Memory (Very) simple binary operations such as add, increment,... Takes one or two numbers, combines them, and writes back result to memory Has a program counter holding one number IO 23; 24; 4 25; 5 26; 27; 28: Memory Long linear sequence of post its (storage locations) Sequence of storage locations holds natural numbers Storage locations are enumerated Example: Add entry 24 and entry 25 and write result back to entry 21 Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 21 of 41

22 Program Counter Processor PC: 113 ALU Memory 21: 22; 23; 24; 4 25; 5 26; 27; 28: 113: add 114; ; ; 21 (Very) simple binary operations such as add, increment,... Takes one or two numbers, combines them, and writes back result to memory Has a program counter holding one number Memory Computer program is a sequence of natural numbers Each number equals command (code) Program counter tells ALU which command to execute next Program counter incremented after each command Random access memory machine RAM machine Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 22 of 41

23 Instruction Streams PC: 113 ALU 21: 22; 23; 24; 4 25; 5 26; 27; 28: Memory 113: add 114; ; ; 21 Properties of machine instructions Code, i.e. number-to-command mapping, is machine-specific Set of available commands is machine-specific Constraints on codes (which codes are allowed when) are machine-specific Performance of a command is machine-specific Writing machine code Cumbersome (small number of directives) Error-prone Not portable We need a more abstract program description (programming language). Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 23 of 41

24 Algorithm An algorithm is a method/recipe expressed as finite list of effective instructions/actions for calculating a function/solving a problem. Where do we find algorithms on a daily basis? Abu Abdullah Muhammad bin Musa al-khwarizmi Persian mathematician, A.D. Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 24 of 41

25 Cooking Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 25 of 41

26 Cooking by Isaac Nassi and Ben Shneiderman Open Door of Appartment All guys enter room Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 26 of 41

27 Cooking by Isaac Nassi and Ben Shneiderman Open Door of Appartment All guys enter room Hungry? Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 27 of 41

28 Cooking by Isaac Nassi and Ben Shneiderman Open Door of Appartment All guys enter room No Hungry? Yes Call Pizza service Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 28 of 41

29 Cooking by Isaac Nassi and Ben Shneiderman Open Door of Appartment All guys enter room No Hungry? Yes For each buddy Open a beer Call Pizza service Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 29 of 41

30 Create your own diagram Write down a Nassi Shneiderman diagram (belonging to structured programming) for the following formula: s(n) = k k with n mod k = 0. Hint: Just run over all k and find out whether they fit into n. Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 30 of 41

31 Translation Concepts Algorithm Compiler (Translator) Compiler (Translator) To be done once Machine Code To be done for each architecture Sell/give it to the customer Install it on the computer Intermediate Code Sell/give it to the customer Install it on the computer Interpreter (Simultan Translator) Machine Code Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 31 of 41

32 A Compiler is a big translation table, i.e. a = 4; b = 5; c = a + b becomes move 4 to 24 move 5 to 25 add to does all the management and linearisation of the memory stream... provides more abstract commands than the machine language can do... manages the program counter... and does a lot more Each real computer scientist has to invent at least one new language and write the corresponding compiler once in his/her lifetime! Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 32 of 41

33 History of C Origins (1970s) Zoo of languages & compilers Among them A and B (Ken Thompson, invented UNIX) Use to write operating systems History of C 1972, Dennis M. Ritchie, Bell Laboratories, AT&T 1973/74, Brian W. Kernighan Purpose: Write operating systems and compilers Fundamental concepts of C Powerful to write an operation system Small number of commands Structuredness (no sequences of assembler code) State of C Used to write UNIX General purpose language Available on all UNIX systems Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 33 of 41

34 History of C++ Bjarne Stroustrup Software Crisis (80s) Complex systems, difficult to maintain Lack of abstraction Lack of modelling facilities Smalltalk and the OOP History of C++ early 80s, Bjarne Stroustrup, Bell Laboratories, AT&T extension of C, i.e. C programs are C++ programs with new ideas of OOP Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 34 of 41

35 C++ State of the Art? PC: 113 ALU Memory 21: 22; 23; 24; 4 25; 5 26; 27; 28: 113: add 114; ; ; 21 Popular languages such as Java or C# are C + + They now adopt concepts of C++ formerly deprecated New paradigms are discussed, but have to stand the test of time Next generation C++0x is not yet released Many application areas (in particular HPC and Scientific Computing) have not yet fully adopted and understood OOP and C++ This course teaches C++ from scratch. However, it does not follow the historic path neither does it start directly with sophisticated OOP concepts. It rather follows the academic path, i.e. introduces one fundamental concept at a time. As OOP (as a concept) still is considered to be sophisticated in our disciplines, it will be the last thing we talk about. Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 35 of 41

36 1.6. Development Workflow Three Tools Coin Our Work Editor (vi, Emacs, Notepad, whatever) to write simple text files Compiler (g++) invoked on the command line Linker (g++) invoked on the command line Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 36 of 41

37 If Programming Were Cooking... Editor (vi, Emacs, Notepad, whatever)... we would write down with the editor the recipe of one single dish such as the dessert or the main course. The recipe then is the algorithm and it is written down as source code which is typically a simple text file with the extensions.c,.cpp, and so forth. Compiler (g++) Linker (g++) Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 37 of 41

38 If Programming Were Cooking... Editor (vi, Emacs, Notepad, whatever) Compiler (g++)... would take the recipe (source code) and cook it. The results are called object code or object files. They typically have the extension.o. It is invoked by g++ -c filename.c. Linker (g++) Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 38 of 41

39 If Programming Were Cooking... Editor (vi, Emacs, Notepad, whatever) Compiler (g++) Linker (g++)... would take the individual dishes and combine them into a complete meal with several courses. It is invoked by g++ filename1.o filename2.o -o outputfile and produces an executable.... there would be a menu card given by several header text files as well. They typically have the extension.h or.hpp. Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 39 of 41

40 Standard Workflow Write down your source codes (files file1.cpp, file2.cpp,...) into text files with an editor of your choice Write down your descriptions (files file1.h, file2.h,...) (we will do this later as it is a matter of style) into text files with an editor of your choice Open your command line and type g++ -c file1.cpp g++ -c file2.cpp g++ file1.o file2.o myappl./myappl produces file1.o produces file2.o produces executable myappl execute myappl Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 40 of 41

41 Exercise vi first-appl.cpp # i n c l u d e <iostream> i n t main ( ) { std : : cout << Hello yourname ; r e t u r n 0; } g++ -c first-appl.cpp ls g++ first-appl.o -o myappl ls./myappl Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 41 of 41

1. Introduction. March 7, 2011

1. Introduction. March 7, 2011 March 7, 2011 Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 1 of 41 Outline The Course The Motivation The Introduction What is a computer? von-neuman architecture What is

More information

11. Generic Programming and Design Patterns. 8. Juli 2011

11. Generic Programming and Design Patterns. 8. Juli 2011 8. Juli 2011 Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 1 of 26 Outline Recapitulation Template Programming An Overview over the STL Design Patterns (skipped) Evaluation/feedback

More information

5. Applicative Programming. 1. Juli 2011

5. Applicative Programming. 1. Juli 2011 1. Juli 2011 Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 1 of 41 Outline Recapitulation Computer architecture extended: Registers and caches Header files Global variables

More information

2. Variables, Identifiers, and Expressions. March 8, 2011

2. Variables, Identifiers, and Expressions. March 8, 2011 March 8, 2011 Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 1 of 34 Outline A Movie Structure of Simple C Codes Comments & Documentation Variables & Identifiers Built-in

More information

PROGRAMMAZIONE I A.A. 2017/2018

PROGRAMMAZIONE I A.A. 2017/2018 PROGRAMMAZIONE I A.A. 2017/2018 PROGRAMMING LANGUAGES A programming language is a formal language that specifies a set of instructions that can be used to produce various kinds of output. Programming languages

More information

Introduction to Programming

Introduction to Programming Introduction to Programming session 3 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2010 These slides are created using Deitel s slides Sahrif University of Technology Outlines

More information

Object Oriented Concepts and Programming (CSC244) By Dr. Tabbasum Naz

Object Oriented Concepts and Programming (CSC244) By Dr. Tabbasum Naz Object Oriented Concepts and Programming (CSC244) By Dr. Tabbasum Naz tabbasum.naz@ciitlahore.edu.pk Course Outline Course Title Object Oriented Concepts and Course Code Credit Hours 4(3,1) Programming

More information

by Pearson Education, Inc. All Rights Reserved.

by Pearson Education, Inc. All Rights Reserved. Programmers write instructions in various programming languages, some directly understandable by computers and others requiring intermediate translation steps. Computer languages may be divided into three

More information

6. Pointers, Structs, and Arrays. 1. Juli 2011

6. Pointers, Structs, and Arrays. 1. Juli 2011 1. Juli 2011 Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 1 of 50 Outline Recapitulation Pointers Dynamic Memory Allocation Structs Arrays Bubble Sort Strings Einführung

More information

Introduction to Basis and Practice in Programming

Introduction to Basis and Practice in Programming Introduction to Basis and Practice in Programming Fall 2015 Jinkyu Jeong (jinkyu@skku.edu) 1 Course Overview Course Basics! Class hour GEDB029-45: Mon. 13:00 ~ 14:50 GEDB029-46: Tue. 13:00 ~ 14:50 1~2

More information

0 Introduction: Computer systems and program development

0 Introduction: Computer systems and program development 0 Introduction: Computer systems and program development Outline 1 Introduction 2 What Is a Computer? 3 Computer Organization 4 Evolution of Operating Systems 5 Personal Computing, Distributed Computing

More information

COSC 2P95. Introduction. Week 1. Brock University. Brock University (Week 1) Introduction 1 / 18

COSC 2P95. Introduction. Week 1. Brock University. Brock University (Week 1) Introduction 1 / 18 COSC 2P95 Introduction Week 1 Brock University Brock University (Week 1) Introduction 1 / 18 Lectures and Labs Lectures are Thursdays, from 3pm 5pm (AS/STH 217) There are two lab sections Lab 1 is Mondays,

More information

What is a programming language?

What is a programming language? Overview Introduction Motivation Why study programming languages? Some key concepts What is a programming language? What is a programming language?...there is no agreement on what a programming language

More information

CS120 Computer Science I. Instructor: Jia Song

CS120 Computer Science I. Instructor: Jia Song CS120 Computer Science I Instructor: Jia Song Instructor Contact Information Instructor: Dr. Jia Song Email: jsong@uidaho.edu (Preferred) Phone: (208) 885-1710 Office: JEB 240 (CSDS Security Lab) JEB 340

More information

Chapter 1 Introduction to Computers and C++ Programming

Chapter 1 Introduction to Computers and C++ Programming Chapter 1 Introduction to Computers and C++ Programming 1 Outline 1.1 Introduction 1.2 What is a Computer? 1.3 Computer Organization 1.7 History of C and C++ 1.14 Basics of a Typical C++ Environment 1.20

More information

CS 50 Introduction to Computer Science I

CS 50 Introduction to Computer Science I CS 50 Introduction to Computer Science I Michael D. Smith smith@eecs.harvard.edu Fall 2005 CS50 1 Q1: What s in common? Internet commerce and electronic markets Blockbuster movies and their special effects

More information

Spring 2018 NENG 202 Introduction to Computer Programming

Spring 2018 NENG 202 Introduction to Computer Programming Spring 2018 NENG 202 Introduction to Computer Programming Introductory programming course based on the C language Course Website: http://www.albany.edu/~yx152122/neng202-18.html Instructor: Prof. Y. Alex

More information

6. Pointers, Structs, and Arrays. March 14 & 15, 2011

6. Pointers, Structs, and Arrays. March 14 & 15, 2011 March 14 & 15, 2011 Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 1 of 47 Outline Recapitulation Pointers Dynamic Memory Allocation Structs Arrays Bubble Sort Strings Einführung

More information

Introduction to C Programming

Introduction to C Programming 13205 C Programming Lecture 1-26/Sept/2017 c 2017 Abel Gomes All Rights Reserved Introduction to C Programming Scribe: A. Gomes This lecture aims to respond to the following questions: Why do we need to

More information

Administration Computers Software Algorithms Programming Languages

Administration Computers Software Algorithms Programming Languages Administration Computers Software Algorithms Programming Languages http://www.cs.sfu.ca/cc/130/johnwill/ This course does not use Canvas John Edgar 3 Come to class Read ahead Attend the labs You get practice

More information

LECTURE/ STUDY NOTES ON C

LECTURE/ STUDY NOTES ON C LECTURE/ STUDY NOTES ON C PART I (Overview of C Programming) Introduction of C language History of C Importance of C Demerits of C Basic Structure of C Working steps of C compiler Source Code Object Code

More information

Introduction to C++ Dr M.S. Colclough, research fellows, pgtas

Introduction to C++ Dr M.S. Colclough, research fellows, pgtas Introduction to C++ Dr M.S. Colclough, research fellows, pgtas 5 weeks, 2 afternoons / week. Primarily a lab project. Approx. first 5 sessions start with lecture, followed by non assessed exercises in

More information

Fundamentals of Programming. Lecture 1: Introduction to C Programming

Fundamentals of Programming. Lecture 1: Introduction to C Programming 1 Fundamentals of Programming Lecture 1: Introduction to C Programming Instructor: Fatemeh Zamani f_zamani@ce.sharif.edu Sharif University of Technology Computer Engineering Department 2 Outline Grading

More information

CS240: Programming in C

CS240: Programming in C CS240: Programming in C Lecture 1: Class overview. Cristina Nita-Rotaru Lecture 1/ Fall 2013 1 WELCOME to CS240 Cristina Nita-Rotaru Lecture 1/ Fall 2013 2 240 Team Instructor: Cristina Nita-Rotaru Special

More information

Exercises: Instructions and Advice

Exercises: Instructions and Advice Instructions Exercises: Instructions and Advice The exercises in this course are primarily practical programming tasks that are designed to help the student master the intellectual content of the subjects

More information

Computer Fundamentals: Pradeep K. Sinha & Priti Sinha

Computer Fundamentals: Pradeep K. Sinha & Priti Sinha Computer Fundamentals Pradeep K. Sinha Priti Sinha Chapter 12 Computer Languages Slide 1/64 Learning Objectives In this chapter you will learn about: Computer languages or programming languages Three broad

More information

Computers and Computation. The Modern Computer. The Operating System. The Operating System

Computers and Computation. The Modern Computer. The Operating System. The Operating System The Modern Computer Computers and Computation What is a computer? A machine that manipulates data according to instructions. Despite their apparent complexity, at the lowest level computers perform simple

More information

Lecture 5: The Halting Problem. Michael Beeson

Lecture 5: The Halting Problem. Michael Beeson Lecture 5: The Halting Problem Michael Beeson Historical situation in 1930 The diagonal method appears to offer a way to extend just about any definition of computable. It appeared in the 1920s that it

More information

CS 240 Fall 2015 Section 004. Alvin Chao, Professor

CS 240 Fall 2015 Section 004. Alvin Chao, Professor CS 240 Fall 2015 Section 004 Alvin Chao, Professor Today Course overview Data Structures / Algorithms Course policies The C language Motivation Computers are digital Data is stored in binary format (1's

More information

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Introduction to Programming Language Concepts

More information

! Learn how to think like a computer scientist. ! Learn problem solving. ! Read and write code. ! Understand object oriented programming

! Learn how to think like a computer scientist. ! Learn problem solving. ! Read and write code. ! Understand object oriented programming 1 TOPIC 1 INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING Topic 1 Introduction to Computer Science and Programming Notes adapted from Introduction to Computing and Programming with Java: A Multimedia

More information

Introduction to Programming

Introduction to Programming Introduction to Programming Lecture 1 Object-Oriented Programming Agenda What is Program? Ideal Computing Way Where We Are in Computers? Interaction with the Computer Where are we going? Programming and

More information

Your first C and C++ programs

Your first C and C++ programs Your first C and C++ programs Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++,

More information

Scientific Computing

Scientific Computing Scientific Computing Martin Lotz School of Mathematics The University of Manchester Lecture 1, September 22, 2014 Outline Course Overview Programming Basics The C++ Programming Language Outline Course

More information

CSCI170 Lecture 1: Analysis of Programming Languages. John Magee 1 September 2011 Some material copyright Jones and Bartlett

CSCI170 Lecture 1: Analysis of Programming Languages. John Magee 1 September 2011 Some material copyright Jones and Bartlett CSCI170 Lecture 1: Analysis of Programming Languages John Magee 1 September 2011 Some material copyright Jones and Bartlett 1 Overview/Questions How can we control the computer s circuits? How does the

More information

Cocoa Design Patterns. Erik M. Buck October 17, 2009

Cocoa Design Patterns. Erik M. Buck October 17, 2009 Cocoa Design Patterns Erik M. Buck October 17, 2009 Topics n What is a design pattern? n Why Focus on design patterns? n What is the Model View Controller design pattern? n Using MVC n When wouldn t you

More information

Week - 01 Lecture - 04 Downloading and installing Python

Week - 01 Lecture - 04 Downloading and installing Python Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 01 Lecture - 04 Downloading and

More information

8. Object-oriented Programming. June 15, 2010

8. Object-oriented Programming. June 15, 2010 June 15, 2010 Introduction to C/C++, Tobias Weinzierl page 1 of 41 Outline Recapitulation Copy Constructor & Operators Object-oriented Programming Dynamic and Static Polymorphism The Keyword Static The

More information

Lecture 19: Topological sort Part 1: Problem and math basis. Topological sort. The problem. Why we are doing this!

Lecture 19: Topological sort Part 1: Problem and math basis. Topological sort. The problem. Why we are doing this! Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. r. Bertrand Meyer October 006 February 007 Lecture 9: Topological sort Part : Problem and math basis Intro.

More information

Plan. Design principles: laughing in the face of change. What kind of change? What are we trying to achieve?

Plan. Design principles: laughing in the face of change. What kind of change? What are we trying to achieve? Plan Design principles: laughing in the face of change Perdita Stevens School of Informatics University of Edinburgh What are we trying to achieve? Review: Design principles you know from Inf2C-SE Going

More information

EL2310 Scientific Programming

EL2310 Scientific Programming Lecture 6: Introduction to C (pronobis@kth.se) Overview Overview Lecture 6: Introduction to C Roots of C Getting started with C Closer look at Hello World Programming Environment Schedule Last time (and

More information

Introduction to Computer Science I

Introduction to Computer Science I Introduction to Computer Science I CSE 1020 www.cse.yorku.ca/course/1020 Programming Contests in September and October Everyone is welcome to participate in these contests. The students who will represent

More information

Chapter 12 (revised by JAS)

Chapter 12 (revised by JAS) Chapter 12 (revised by JAS) Pattern-Based Design Slide Set to accompany Software Engineering: A Practitionerʼs Approach, 7/e by Roger S. Pressman Slides copyright 1996, 2001, 2005, 2009 by Roger S. Pressman

More information

Introduction. A. Bellaachia Page: 1

Introduction. A. Bellaachia Page: 1 Introduction 1. Objectives... 2 2. Why are there so many programming languages?... 2 3. What makes a language successful?... 2 4. Programming Domains... 3 5. Language and Computer Architecture... 4 6.

More information

Principles of computer programming. Profesor : doc. dr Marko Tanasković Assistent : doc. dr Marko Tanasković

Principles of computer programming. Profesor : doc. dr Marko Tanasković Assistent : doc. dr Marko Tanasković Principles of computer programming Profesor : doc. dr Marko Tanasković Assistent : doc. dr Marko Tanasković E-mail: mtanaskovic@singidunum.ac.rs Course organization Lectures: Presentation of concepts and

More information

Lecture 1: Preliminaries

Lecture 1: Preliminaries Lecture 1: Preliminaries Edgardo Molina Department of Computer Science City College of New York August 30, 2011 Edgardo Molina (CS@CCNY) Lecture 1 August 30, 2011 1 / 44 Info and Schedule Course Info and

More information

Aggregation headers. Introduction

Aggregation headers. Introduction Aggregation headers N2905=09-0095 2009-06-18 Bjarne Stroustrup Abstract I propose two new standard headers and which are aggregations of other headers. The purpose of the first

More information

Chapter 1: Introduction

Chapter 1: Introduction Chapter 1: Introduction Outline Introduction What Is a Computer? Computer Hardware Computer Software Computer Programming Languages Machine Code, Assembly Languages and High-Level Languages. The History

More information

Application of a Visual Computer Simulator into Collaborative Learning

Application of a Visual Computer Simulator into Collaborative Learning Journal of Computing and Information Technology - CIT 14, 2006, 4, 267 273 doi:10.2498/cit.2006.04.01 267 Application of a Visual Computer Simulator into Collaborative Learning Yoshiro Imai 1, Keiichi

More information

Chapter 1: An Overview of Computers and Programming Languages. Objectives. Objectives (cont d.) Introduction

Chapter 1: An Overview of Computers and Programming Languages. Objectives. Objectives (cont d.) Introduction Chapter 1: An Overview of Computers and Programming Languages Objectives Objectives (cont d.) In this chapter, you will: Learn about different types of computers Explore hardware and software Learn about

More information

Harvard-MIT Division of Health Sciences and Technology HST.952: Computing for Biomedical Scientists HST 952. Computing for Biomedical Scientists

Harvard-MIT Division of Health Sciences and Technology HST.952: Computing for Biomedical Scientists HST 952. Computing for Biomedical Scientists Harvard-MIT Division of Health Sciences and Technology HST.952: Computing for Biomedical Scientists HST 952 Computing for Biomedical Scientists Introduction Medical informatics is interdisciplinary, and

More information

CS102 Unit 2. Sets and Mathematical Formalism Programming Languages and Simple Program Execution

CS102 Unit 2. Sets and Mathematical Formalism Programming Languages and Simple Program Execution 1 CS102 Unit 2 Sets and Mathematical Formalism Programming Languages and Simple Program Execution 2 Review Show how "Hi!\n" would be stored in the memory below Use decimal to represent each byte Remember

More information

Why do we have to know all that? The stored program concept (the procedural paradigm) Memory

Why do we have to know all that? The stored program concept (the procedural paradigm) Memory Session 1b: Background & Preliminaries What is computer programming? The stored-program concept. The procedural paradigm. What is a programming language? The object-oriented paradigm C#: ancestors & origins

More information

(0) introduction to the course. how to learn a programming language. (0) course structure

(0) introduction to the course. how to learn a programming language. (0) course structure topics: (0) introduction to the course (1) what is a computer? instructor: cis1.5 introduction to computing using c++ (robotics applications) spring 2008 lecture # I.1 introduction Prof Azhar, mqazhar@sci.brooklyn.cuny.edu

More information

Chapters 1 & 2 Programming and Programs

Chapters 1 & 2 Programming and Programs Chapters 1 & 2 Programming and Programs Instructor: Dr. Hyunyoung Lee Based on slides by Dr. Bjarne Stroustrup www.stroustrup.com/programming Abstract Today, we ll outline the aims for this course and

More information

EP241 Computer Programming

EP241 Computer Programming EP241 Computer Programming Topic 1 Dr. Ahmet BİNGÜL Department of Engineering Physics University of Gaziantep Modifications by Dr. Andrew BEDDALL Department of Electric and Electronics Engineering Sep

More information

Script for Interview about LATEX and Friends

Script for Interview about LATEX and Friends Script for Interview about LATEX and Friends M. R. C. van Dongen July 13, 2012 Contents 1 Introduction 2 2 Typography 3 2.1 Typeface Selection................................. 3 2.2 Kerning.......................................

More information

SYLLABUS. 1. Information regarding the programme 1.1 Higher education Babeş-Bolyai University of Cluj-Napoca

SYLLABUS. 1. Information regarding the programme 1.1 Higher education Babeş-Bolyai University of Cluj-Napoca SYLLABUS 1. Information regarding the programme 1.1 Higher education Babeş-Bolyai University of Cluj-Napoca institution 1.2 Faculty Faculty of Mathematics and Computer Science 1.3 Departament Departament

More information

COMP1917: Computing 1 1. Introduction

COMP1917: Computing 1 1. Introduction COMP1917: Computing 1 1. Introduction Reading: Moffat, Chapter 1. COMP1917 15s2 Introduction 1 Course Web Site http://www.cse.unsw.edu.au/~cs1917/15s2 Please check this Web Site regularly for updated information,

More information

Introduction to Computing using C++ Biomedical applications WELCOME TO CIS 1.5. Introduction to the course. Course structure

Introduction to Computing using C++ Biomedical applications WELCOME TO CIS 1.5. Introduction to the course. Course structure Introduction to Computing using C++ Biomedical applications WELCOME TO CIS 1.5 Topics: Introduction to the course What is a computer programming language? Instructor: Prof Simon Parsons parsons@sci.brooklyn.cuny.edu

More information

4. Functions. March 10, 2010

4. Functions. March 10, 2010 March 10, 2010 Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 1 of 40 Outline Recapitulation Functions Part 1 What is a Procedure? Call-by-value and Call-by-reference Functions

More information

Tuesday, October 4. Announcements

Tuesday, October 4. Announcements Tuesday, October 4 Announcements www.singularsource.net Donate to my short story contest UCI Delta Sigma Pi Accepts business and ICS students See Facebook page for details Slide 2 1 Design Patterns Design

More information

An Introduction to Software Engineering. David Greenstein Monta Vista High School

An Introduction to Software Engineering. David Greenstein Monta Vista High School An Introduction to Software Engineering David Greenstein Monta Vista High School Software Today Software Development Pre-1970 s - Emphasis on efficiency Compact, fast algorithms on machines with limited

More information

Introduction to Linux

Introduction to Linux Why Linux? Nothing is hidden (opensource is good for education) It runs anywhere, on almost anything Android, OS X, Raspberry Pi, Old PCs Low resource requirements You are likely to use it in your job,

More information

1 Software Architecture

1 Software Architecture Some buzzwords and acronyms for today Software architecture Design pattern Separation of concerns Single responsibility principle Keep it simple, stupid (KISS) Don t repeat yourself (DRY) Don t talk to

More information

C Programming. A quick introduction for embedded systems. Dr. Alun Moon UNN/CEIS. September 2008

C Programming. A quick introduction for embedded systems. Dr. Alun Moon UNN/CEIS. September 2008 C Programming A quick introduction for embedded systems Dr. Alun Moon UNN/CEIS September 2008 Dr. Alun Moon (UNN/CEIS) C Programming September 2008 1 / 13 Programming is both an art and a science. It is

More information

CPSC 427a: Object-Oriented Programming

CPSC 427a: Object-Oriented Programming CPSC 427a: Object-Oriented Programming Michael J. Fischer Lecture 2 September 6, 2011 CPSC 427a 1/14 C++ Overview C++ Goals Comparison of C and C++ Tools Example Insertion sort C version C++ version CPSC

More information

Design Patterns. CSC207 Fall 2017

Design Patterns. CSC207 Fall 2017 Design Patterns CSC207 Fall 2017 Design Patterns A design pattern is a general description of the solution to a well-established problem using an arrangement of classes and objects. Patterns describe the

More information

Introduction to Computers and Visual Basic.Net Pearson Education, Inc. All rights reserved.

Introduction to Computers and Visual Basic.Net Pearson Education, Inc. All rights reserved. 1 1 Introduction to Computers and Visual Basic.Net 2 OBJECTIVES In this chapter you will learn: Basic computing concepts. The different types of programming languages. The evolution of the Basic Programming

More information

C++ Spring Break Packet 11 The Java Programming Language

C++ Spring Break Packet 11 The Java Programming Language C++ Spring Break Packet 11 The Java Programming Language! Programmers write instructions in various programming languages, some directly understandable by computers and others requiring intermediate translation

More information

Topics in Object-Oriented Design Patterns

Topics in Object-Oriented Design Patterns Software design Topics in Object-Oriented Design Patterns Material mainly from the book Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides; slides originally by Spiros Mancoridis;

More information

Computer Principles and Components 1

Computer Principles and Components 1 Computer Principles and Components 1 Course Map This module provides an overview of the hardware and software environment being used throughout the course. Introduction Computer Principles and Components

More information

CSc 10200! Introduction to Computing. Lecture 1 Edgardo Molina Fall 2013 City College of New York

CSc 10200! Introduction to Computing. Lecture 1 Edgardo Molina Fall 2013 City College of New York CSc 10200! Introduction to Computing Lecture 1 Edgardo Molina Fall 2013 City College of New York 1 Introduction to Computing Lectures: Tuesday and Thursday s (2-2:50 pm) Location: NAC 1/202 Recitation:

More information

Unit. Programming Fundamentals. School of Science and Technology INTRODUCTION

Unit. Programming Fundamentals. School of Science and Technology INTRODUCTION INTRODUCTION Programming Fundamentals Unit 1 In order to communicate with each other, we use natural languages like Bengali, English, Hindi, Urdu, French, Gujarati etc. We have different language around

More information

Announcements Tues., Aug and 2. to call them ( ) ! For next time, read Learning Computing with Robots, chs.

Announcements Tues., Aug and 2. to call them ( ) ! For next time, read Learning Computing with Robots, chs. Announcements Tues., Aug. 24! For next time, read Learning Computing with Robots, chs. 1 and 2.! The Blackboard site is up and operational!! not much content! mostly links back to my course homepage! Printed

More information

PROPOSAL TO INTRODUCE A NEW COURSE

PROPOSAL TO INTRODUCE A NEW COURSE PROPOSAL TO INTRODUCE A NEW COURSE 1. COURSE DETAILS 1.1 Course ID COMP3021 1.2 Course name -- Long Object-Oriented Programming 1.3 Course name -- Abbreviated OOP 1.4 Course Authority Assoc. Professor

More information

What is programming? What are computer languages and how have they evolved? What is the basic process of programming, including the tools involved?

What is programming? What are computer languages and how have they evolved? What is the basic process of programming, including the tools involved? What is programming? What are computer languages and how have they evolved? What is the basic process of programming, including the tools involved? A step-by-step set of instructions to accomplish a task.

More information

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College October 22, 2018 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers ords Data Types And Variable Declarations

More information

1 Anatomy of a Program 4

1 Anatomy of a Program 4 Objectives Anatomy of a Program 1E3 To understand the role of basic C++ program elements. To provide a skeleton from which to generate simple programs. 1 Anatomy of a Program 1 1 Anatomy of a Program 2

More information

Component V Supporting Materials / Learn More Interesting Facts. Interesting Facts

Component V Supporting Materials / Learn More Interesting Facts. Interesting Facts Component V Supporting Materials / Learn More 1.4.1 Interesting Facts No. Interesting Facts 1. All computers operate by following machine language programs. 2. Machine language programs are long sequence

More information

Application Architectures, Design Patterns

Application Architectures, Design Patterns Application Architectures, Design Patterns Martin Ledvinka martin.ledvinka@fel.cvut.cz Winter Term 2017 Martin Ledvinka (martin.ledvinka@fel.cvut.cz) Application Architectures, Design Patterns Winter Term

More information

Tackling Design Patterns Chapter 3: Template Method design pattern and Public Inheritance. 3.1 Introduction... 2

Tackling Design Patterns Chapter 3: Template Method design pattern and Public Inheritance. 3.1 Introduction... 2 Department of Computer Science Tackling Design Patterns Chapter 3: Template Method design pattern and Public Inheritance Copyright c 2016 by Linda Marshall and Vreda Pieterse. All rights reserved. Contents

More information

Welcome to CS 106L! Ali Malik

Welcome to CS 106L! Ali Malik Welcome to CS 106L! Ali Malik malikali@stanford.edu Game Plan Welcome Why CS106L? Logistics History and Philosophy of C++ C++ Basics Welcome! Instructor Ali Malik malikali@stanford.edu Instructor Ali Malik

More information

Design Patterns. CSC207 Fall 2017

Design Patterns. CSC207 Fall 2017 Design Patterns CSC207 Fall 2017 Design Patterns A design pattern is a general description of the solution to a well-established problem using an arrangement of classes and objects. Patterns describe the

More information

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG) SKILL AREA 304: Review Programming Language Concept Computer Programming (YPG) 304.1 Demonstrate an Understanding of Basic of Programming Language 304.1.1 Explain the purpose of computer program 304.1.2

More information

Operating System Study Material

Operating System Study Material The operating system works as a mediator between hardware, application software and user. Operating systems are programs that coordinate computer resources, provide an interface between users and the computer,

More information

CS 113: Introduction to

CS 113: Introduction to CS 113: Introduction to Course information MWF 12:20-1:10pm 1/21-2/15, 306 Hollister Hall Add/drop deadline: 1/28 C Instructor: David Crandall See website for office hours and contact information Prerequisites

More information

Welcome to. Instructor Marc Pomplun CS 470/670. Introduction to Artificial Intelligence 1/26/2016. Spring Selectivity in Complex Scenes

Welcome to. Instructor Marc Pomplun CS 470/670. Introduction to Artificial Intelligence 1/26/2016. Spring Selectivity in Complex Scenes Welcome to CS 470/670 Introduction to Artificial Intelligence Office: Lab: Instructor Marc Pomplun S-3-171 S-3-135 Office Hours: Tuesdays 4:00pm 5:30pm Thursdays 7:00pm 8:30pm Spring 2016 Instructor: Marc

More information

CISC 124: Introduction To Computing Science II

CISC 124: Introduction To Computing Science II CISC 124: Introduction To Computing Science II instructor: Margaret Lamb instructor's home page: www.cs.queensu.ca/home/malamb office: Goodwin 527 current office hours are always on my home page 1 Moodle

More information

PROGRAMMING LANGUAGE PARADIGMS & THE MAIN PRINCIPLES OF OBJECT-ORIENTED PROGRAMMING

PROGRAMMING LANGUAGE PARADIGMS & THE MAIN PRINCIPLES OF OBJECT-ORIENTED PROGRAMMING 10.2478/cris-2013-0011 PROGRAMMING LANGUAGE PARADIGMS & THE MAIN PRINCIPLES OF OBJECT-ORIENTED PROGRAMMING NIKOLETTA MINAROVA 77 INTRODUCTION Since the first design concept of computers came into the world,

More information

Welcome to Solving Problems with Computers I

Welcome to Solving Problems with Computers I Welcome to Solving Problems with Computers I CS 16: Solving Problems with Computers I Lecture #1 Ziad Matni Dept. of Computer Science, UCSB Image from agorolabs on slideshare.com A Word About Registration

More information

COMP1917: Computing 1 1. Introduction

COMP1917: Computing 1 1. Introduction COMP1917: Computing 1 1. Introduction Reading: Moffat, Chapter 1. COMP1917 12s2 Introduction 1 Course Web Site http://www.cse.unsw.edu.au/~cs1917/12s2 Please check this Web Site regularly for updated information,

More information

An Expert System for Design Patterns Recognition

An Expert System for Design Patterns Recognition IJCSNS International Journal of Computer Science and Network Security, VOL.17 No.1, January 2017 93 An Expert System for Design Patterns Recognition Omar AlSheikSalem 1 and Hazem Qattous 2 1 Department

More information

CSCE 110 PROGRAMMING FUNDAMENTALS

CSCE 110 PROGRAMMING FUNDAMENTALS CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 2. Overview of C++ Prof. Amr Goneid, AUC 1 Overview of C++ Prof. Amr Goneid, AUC 2 Overview of C++ Historical C++ Basics Some Library

More information

1 The Catholic University of Eastern Africa P.o Box , Nairobi Kenya Edward Kioko 2013

1 The Catholic University of Eastern Africa P.o Box , Nairobi Kenya Edward Kioko 2013 Purpose of the module (A constituent College of Kenyatta University) P.O Box 136-90100, Machakos Kenya Telephone: 044-21604 Email: info@machakosuniversity.ac.ke Website: http://www.machakosuniversity.ac.ke

More information

Rules. Solution. Telling a computer how to behave: intro to algorithms + pseudocode. Today. Steps in solving a computational task

Rules. Solution. Telling a computer how to behave: intro to algorithms + pseudocode. Today. Steps in solving a computational task Today n Binary! n Intro to algorithms and pseudocode n Discussion of readings Reminders: Leading discussions Blog posts! Bring laptops with face project ready to show off on Thursday. Telling a computer

More information

Why do some students find programming in C, so difficult? It involves thinking. We have been programmed by our respective school boards not to think.

Why do some students find programming in C, so difficult? It involves thinking. We have been programmed by our respective school boards not to think. In June 2018, I asked to a group of 18,738 students, Why do some students find programming in C, so difficult? The first answer was, It involves thinking. We have been programmed by our respective school

More information

10. Object-oriented Programming. 7. Juli 2011

10. Object-oriented Programming. 7. Juli 2011 7. Juli 2011 Einführung in die Programmierung Introduction to C/C++, Tobias Weinzierl page 1 of 47 Outline Object Case Study Brain Teaser Copy Constructor & Operators Object-oriented Programming, i.e.

More information

CS103 Lecture 1 Slides. Introduction Mark Redekopp

CS103 Lecture 1 Slides. Introduction Mark Redekopp 1 CS103 Lecture 1 Slides Introduction Mark Redekopp 2 What is Computer Science All science is computer science It is very interdisciplinary: Math, Engineering, Medicine, Natural sciences, Art, Linguistics,

More information

CS 307: Software Engineering. Lecture 10: Software Design and Architecture

CS 307: Software Engineering. Lecture 10: Software Design and Architecture CS 307: Software Engineering Lecture 10: Software Design and Architecture Prof. Jeff Turkstra 2017 Dr. Jeffrey A. Turkstra 1 Announcements Discuss your product backlog in person or via email by Today Office

More information