T01. Outline and concepts Promising future comes from the dedication.

Slides:



Advertisements
Similar presentations
C++ Introduction.
Advertisements

Chapter 8 Technicalities: Functions, etc. Bjarne Stroustrup
Introduction to Programming in C++ John Galletly.
Introduction to C Programming
 2005 Pearson Education, Inc. All rights reserved Introduction.
Introduction to C Programming
Chapters 1 & 2 Programming and Programs
COSC 120 Computer Programming
Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
1 Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Three types of computer languages
If You Missed Last Week Go to Click on Syllabus, review lecture 01 notes, course schedule Contact your TA ( on website) Schedule.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Software Engineering Principles and C++ Classes
Chapter 1 Program Design
Introduction to C Programming
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
C++ fundamentals.
Introduction To C++ Programming 1.0 Basic C++ Program Structure 2.0 Program Control 3.0 Array And Structures 4.0 Function 5.0 Pointer 6.0 Secure Programming.
Chapters 1 & 2 Programming and Programs
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
COMPUTER PROGRAMMING. Introduction to C++ History Merges notions from Smalltalk and notions from C The class concept was borrowed from Simular67 Developed.
Chapter Introduction to Computers and Programming 1.
COMPUTER SCIENCE I C++ INTRODUCTION
A First Program Using C#
Introduction to C++ - How C++ Evolved Most popular languages currently: COBOL, Fortran, C, C++, Java (script) C was developed in 1970s at AT&T (Richie)
Chapters 1 & 2 Programming and Programs John Keyser’s Modifications of Slides by Bjarne Stroustrup
1 CSC 427: Data Structures and Algorithm Analysis Fall 2011 See online syllabus (also available through BlueLine): Course goals:
Lecture 1 Programming and Programs Bjarne Stroustrup modified by Hugh Murrell.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Getting Started Lecture 1 Hartmut Kaiser
Gator Engineering 1 Chapter 2 C Fundamentals Copyright © 2008 W. W. Norton & Company. All rights reserved.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
Introduction of C++ language. C++ Predecessors Early high level languages or programming languages were written to address a particular kind of computing.
Programming Languages: History & Traditional Concepts CSC 2001.
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
CS 114 – Class 02 Topics  Computer programs  Using the compiler Assignments  Read pages for Thursday.  We will go to the lab on Thursday.
Chapter 1 Introduction to Computers and C++ Programming Goals: To introduce the fundamental hardware and software components of a computer system To introduce.
CSC1201: Programming Language 2 Lecture 1 Level 2 Course Nouf Aljaffan Snd Term Nouf Aljaffan (C) CSC 1201 Course at KSU1.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Programming Fundamentals. Today’s Lecture Why do we need Object Oriented Language C++ and C Basics of a typical C++ Environment Basic Program Construction.
Prepared by: Elsy Torres Shajida Berry Siobhan Westby.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Chapters 1 & 2 Programming and Programs Bjarne Stroustrup
A first program 1. #include 2. using namespace std; 3. int main() { 4. cout
1 CSC 427: Data Structures and Algorithm Analysis Fall 2006 See online syllabus (also available through Blackboard): Course goals:
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
Copyright © 2014 Pearson Addison-Wesley. All rights reserved. Chapter 2 C++ Basics.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
C++ Programming Chapter 1 Programming & Programs.
CSE-102: PROGRAMMING FUNDAMENTALS LECTURE 3: BASICS OF C Course Instructor: Syed Monowar Hossain 1.
Maitrayee Mukerji. INPUT MEMORY PROCESS OUTPUT DATA INFO.
Chapters 1 & 2 Programming and Programs
Lecture 1b- Introduction
Programming what is C++
Topic: Python’s building blocks -> Variables, Values, and Types
Engineering Problem Solving With C An Object Based Approach
ANNOUNCEMENT The missed lecture will be made up this Monday evening in the Tech PC classroom (MG51). A tentative time interval is 6:30-8:00. The exact.
Getting Started with C.
Programming 1 (CS112) Dr. Mohamed Mostafa Zayed 1.
Chapters 1 & 2 Programming and Programs
Introduction to Data Structure
Capitolo 1 – Introduction C++ Programming
Getting Started Lecture 1 Hartmut Kaiser
Presentation transcript:

T01. Outline and concepts

Promising future comes from the dedication

Topics 1.Course outline. 2.Concept of programming P175B013 T01 3

Course outline

Introduction to programming P175B013 Liudas Motiejūnas,

Course Target For beginners who want to become professionals i.e., people who can produce systems that others will use who are assumed to be bright Though not (necessarily) geniuses who are willing to work hard Though do need sleep occasionally, and take a normal course load Using the C++ programming language Some experience in programming is preferred

The Aims Teach/learn Fundamental programming concepts Key useful techniques Basic standard C++ facilities After the course, you’ll be able to Write small colloquial C++ programs Read much larger programs Learn the basics of many other languages by yourself Proceed with next programming course

Why C++? You can’t learn to program without a programming language C++ is the language that most directly allows you to express ideas from the largest number of application areas C++ is widely used language in different areas C++ has inspired several other programming languages and still remains in large use. Programming concepts that you learn using C++ can be used fairly directly in other languages

Programming languages P175B013 T01 9 C family langua ges >50%

P175B013 T01 10 Rough course outline Introduction to object-oriented programming I/O facilities Program structuring Objects and arrays Basic algorithms on arrays Containers

P175B013 T01 11 Practice P0. C++ tool. P1. Class. P2. Array of objects. P3. Container.

P175B013 T01 12 Time table

P175B013 T01 13 Final score P = ( P1 + P2 + P3) / 3, where: P i – assessment( up to 10), Final score = P * 0,7 + T *0,3 T - test (All grades ≥ 5)

P175B013 T01 14 Exam If there will be assignements with grades less than 5 after semester, exam will be mandatory. Exam (oral) – questions from your programs Final score = P * 0,5 + T * 0,2 + E * 0,3 E - exam

P175B013 T01 15 Microsoft Visual C Express Edition : us/download/default.aspx Tool

P175B013 T01 16 Visual C++ tool

P175B013 T01 17 #include // the library facilities needed using namespace std; // name space int main()// main() is where every C++ program starts { cout << "Hello, world!\n"; // output the 13 characters Hello, world! // followed by a new line return 0;// return a value indicating success } // note the semicolons; they terminate statements // curly brackets { … } group statements into a block // main( ) is a function that takes no arguments ( ) // and returns an int (integer value) to indicate success A first program

P175B013 T01 18 It’s almost all “boiler plate” Only cout << "Hello, world!\n" directly does anything That’s normal Most of our code, and most of the systems we use simply exist to make some other code elegant and/or efficient “Boiler plate,” that is, notation, libraries, and other support is what makes our code simple, comprehensible, trustworthy, and efficient. We should not just “get things done”; we should take great care that things are done elegantly, correctly, and in ways that ease the creation of more/other software: Style Matters! Hello world

P175B013 T01 19 Compilation and linking C++ source code C++ compiler Object code Linker Library Object code Executable program

P175B013 T01 20 Linker works if there no errors Information on warnings and errors is shown in the lower window below the program text Read the information and correct the program Syntax errors Debugging of the program

P175B013 T01 21 You have executable program You have to test it: To enter the data in order to validate the program The test has to be designed for every branch of the program Testing of the program

P175B013 T01 22 Conventional definition A plan for solving a problem on a computer Specifying the order of a program execution But modern programs often involve millions of lines of code And manipulation of data is central The definition we’ll use Specifying the structure and behavior of a program, and testing that the program performs its task correctly Never forget to check that “it” works Software == one or more programs Definition of the programming

P175B013 T01 23 Programming is fundamentally simple Just state what the machine is to do So why is programming hard? We want “the machine” to do complex things And computers are nitpicking, unforgiving, dumb beasts The world is more complex than we’d like to believe So we don’t always know the implications of what we want “Programming is understanding” When you can program a task, you understand it When you program, you spend significant time trying to understand the task you want to automate Programming is part practical, part theory If you are just practical, you produce non-scalable unmaintainable hacks If you are just theoretical, you produce toys Programming activity

P175B013 T01 24 Summary  Course structure  Course contents  System of the assessments  Program development environment  Definition of the programming  Questions? 24

Concept of object-oriented programming

Topics 1.Representation of real world. 2.Features of object-oriented programming. 3.The beginning of the example. P175B013 T01 26

P175B013 T01 27 Real world and abstraction Objects in the real world: – Men, cars, goods Characteristics of the objects in the real world: – What they have (features) – What they can (behavior) Objects in the computer are abstractions

P175B013 T01 28 Abstraction and computer Principle of the abstraction: – To model features and behavior related to the particular task only Features in the computer are data Behavior is described by the functions or methods

P175B013 T01 29 Grouping of objects Some of the real world objects have a lot in common: – Object group students – Object group professors – Object group cars Therefore, the features and behavior of the group can be described once and then used a lot of times for every particular object

Class and object Class describes group of the objects. Class is a type. Object is the representative of the class. Object is a variable – Real implementation of the class Objects have different data but their behavior is the same. P175B013 T01 30

Description General form (class): class ClassName { Features Behavior }; General form (objects): ClassName object1, object2,... ; P175B013 T01 31

P175B013 T01 32 Description of the class Class name has to be unique identifier in the name space. Description of the class is stored in the file.h. Implementation of the class is stored in the file.cpp. The class name is valid in all the file.cpp that the following: #include "filename.h"

OOP principles

P175B013 T01 34 History Became popular in the last decade of the XX century Languages: – Smalltalk, C++, Java, C#, C objective Terminology: – Class, object, encapsulation, inheritance, polymorphism, method.

P175B013 T01 35 The basic idea Data and functions, which operate on these data, are bundled into the same unit:  The data of the class are not directly accessible outside of the class  If there is need to change the data, the interface methods of the class has to be used This principle is called encapsulation.

Other principles Inheritance: Hierarchy of classes Abstract classes at the top More specialized at the bottom of the tree. Polymorphism: Ability of the object to behave depending on the context

P175B013 T01 37 Object-oriented program

Stages of the programming Analysis of the task, Choice of the solution, Design of the algorithm Coding, Debugging, Testing, Execution P175B013 T01 38

Programming language Programming language – tool to write the code that is understood be the computer. C language was created in 1972 as the part of the UNIX Its successor is C++

C++ C++ was created by Bjarne Stroustrup in the years between 1981 and The standards are created regularly The last standard was accepted in 2011.

Program development tool

Tool Visual Studio The development starts from the creation of the project Next, you added an item to the project –.cpp file – class P175B013 T01 42

Student’s version Microsoft Visual C Express Edition can be loaded freely from the Microsoft page. You need registration with this page only

Beginning of the example

Problem The following information is available about goods: name, code, price of single unit. Two customers bought several items of goods. You have to calculate total sum that the goods cost P175B013 T01 45 Eggs EGG0001 3,27 John 1 Emily 3 Eggs EGG0001 3,27 John 1 Emily 3

Basic data types Data have to be declared: int – integer numbers; double – real numbers; char – single characters; string – line of text. There are more types available P175B013 T01 46

Declaration int count; doublesum, price; charcharact; stringline, name; P175B013 T01 47

Example: class of single item class Item { string name; string code; double price; }; P175B013 T01 48

Example: class of buyer class Buyer { string name; int count; }; P175B013 T01 49

Declaration of objects Item item1; Buyer buyer1, buyer2; P175B013 T01 50

Problems We can not proceed because: P175B013 T01 51

Summary 1.Introduction to programming 2.Object-oriented programming (OOP) 3.C++ 4.Tool – VS Studio C++ P175B013 T01 52

Questions?