1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal 14300 Pulau Pinang Week 1.

Slides:



Advertisements
Similar presentations
C++ Introduction.
Advertisements

1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 10.
Introduction to Programming in C++ John Galletly.
Algorithms Series of mathematical or variable manipulations Integer a,b,c a = 12 b = 22 c = a * b (what is c?) 12 * 22 = 264.
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 3.
Software. What Is Software? software –Also called Computer programs –Are a list of instructions –Instructions are called code –CPU performs the instructions.
COSC 120 Computer Programming
CIS 101: Computer Programming and Problem Solving Lecture 8 Usman Roshan Department of Computer Science NJIT.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering 3 October 2007.
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Chapter 8: Introduction to High-level Language Programming Invitation to Computer Science, C++ Version, Third Edition.
General Computer Science for Engineers CISC 106 Lecture 26 Dr. John Cavazos Computer and Information Sciences 04/24/2009.
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.
Chapter 1 Introduction to Programming. Computer Hardware CPU Memory –Main or primary –Secondary or auxiliary Input device(s) Output device(s)
CHAPTER 1: INTORDUCTION TO C LANGUAGE
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.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
PRINCIPLES OF PROGRAMMING Revision. A Computer  A useful tool for solving a great variety of problems.  To make a computer do anything (i.e. solve.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Intro. to Game Programming Want to program a game?
High-Level Programming Languages: C++
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
COP1220/CGS2423 Introduction to C++/ C for Engineers Professor: Dr. Miguel Alonso Jr. Fall 2008.
Instructor: Tina Tian. About me Office: RLC 203A Office Hours: Wednesday 1:30 - 4:30 PM or .
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Introduction of C++ language. C++ Predecessors Early high level languages or programming languages were written to address a particular kind of computing.
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 9.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 13: An Introduction to C++
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 4.
Programming With C.
Chapter 1 Introduction to Computers and C++ Programming Goals: To introduce the fundamental hardware and software components of a computer system To introduce.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1 October 20, October 20, 2015October 20, 2015October 20,
Overview of Programming and Problem Solving Textbook Chapter 1 1.
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 9.
C Language: Introduction
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.
CHAPTER 1 INTRODUCTION 1 st semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 2.
CS Computer Science I. BCPL was developed in 1967 as a language for writing operating systems and software compilers In 1970, the creators of the.
FOUNDATION IN INFORMATION TECHNOLOGY (CS-T-101) TOPIC : INFORMATION SYSTEM – SOFTWARE.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
12/18/2015 CSI Chapter 1 1 Compiler + Linker = Ready to run code Compiler translates high-level language source code into an intermediate object.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 6.
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 10.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Think First, Code Second Understand the problem Work out step by step procedure for solving the problem (algorithm) top down design and stepwise refinement.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
1 8/30/06CS150 Introduction to Computer Science 1 Your First C++ Program.
小型系統 心情 vs. 古典樂 心情 vs. 古典樂 浪漫求籤系統 美食導航系統 季潔亭雅鈺熒岱芸 美食導航系統 楊氏音樂模擬大會考人瑋 若維 芷萱 伽倩 楊氏音樂模擬大會考 麥當勞熱量計算系統 火星文困擾你嗎 ? 火星文困擾你嗎 ? 歌詞知多少 - 挑戰你的腦容量英琪 日馨 青雪 鈺娟.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Software Engineering Algorithms, Compilers, & Lifecycle.
C++ Programming Chapter 1 Programming & Programs.
Introduction to Computers and C++ Programming
Algorithms, problem solving and Introduction to C++
CSCI-235 Micro-Computer Applications
EMT 101 – Engineering Programming
Introduction to C++ Introduced by Bjarne Stroustrup of AT&T’s Bell Laboratories in mid-1980’s Based on C C++ extended C to support object-oriented programming.
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.
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Introduction to C++ Introduced by Bjarne Stroustrup of AT&T’s Bell Laboratories in mid-1980’s Based on C C++ extended C to support object-oriented programming.
The Programming Process
Introduction to Computer Programming
CS IA: Procedural Programming CS IB: Object-Oriented Programming
Programs written in C and C++ can run on many different computers
Presentation transcript:

1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 1

2 What Can You Do with Programming? As a database control Web based application Machine or Electronics control Systems control (UAV) Software development Solve Engineering Problems (Simulation)

3 What is Programming? A computer needs ‘something’ to tell it what to do to perform certain tasks The tasks may require precise details and multiple steps That ‘something’ is called a computer program. The process of developing and executing the computer program is called computer programming.

4 Computer User versus Computer Programmer You can use a computer without doing any programming A Facebook user does not need to know how the software has been programmed to be able to use Facebook Analogy: You can ride a motorcyle without being a mechanic, operate a TV without being an electrician Most computer users may never have to perform programming!

5 Computer User versus Computer Programmer A programmer develops a software(s) for computer users to use Programmers not only come from computer engineers or scientists but also other engineering or scientific disciplines Programming is a very interesting and rewarding activity: write a computer game with sound and motion Programmers fully direct the computer as their slaves to extend their brain capabilities

6 What is a Program Program = Data + Algorithm All in source code Written in various languages High level languages requires: 1- Compile 2- Link or Build 3- Execute

7 Choices of Programming Language Machine language FortranCC++Java

8 Machine Language The most primitive yet the most efficient way of communicating with the computer Task: 1) Move contents of memory location into location ET 1) Move contents of memory location into location ET 2) Add the value 3000 from memory location ET 2) Add the value 3000 from memory location ET 3) If the outcome is negative, proceed with instruction located in memory location ) If the outcome is negative, proceed with instruction located in memory location 5432 In machine language the instruction reads:

9 Fortran Language The first high level language developed in 1957, mainly for solving mathematical problems In FOTRAN 77 the task now reads: REAL*8 X10000 REAL*8 X10000 REAL*8 ET REAL*8 ET X10000= 10.d0 X10000= 10.d0 ET = X d0 ET = X d0 IF (ET.LT. 0.d0) IF (ET.LT. 0.d0) CALL F(X5432) CALL F(X5432) ENDIF ENDIF

10 C, C++ Language C developed in 1970 (Dennis Ritchie) followed by C++ in 1980 (Bjaern Stroustrup) In C++ the task now reads X10000 = 10.0; X10000 = 10.0; float ET; float ET; ET = X ; ET = X ; If (ET < 0) If (ET < 0) { F(X5432); F(X5432); }

11 Differences between these languages The machine language is the most ‘direct’ form of communication between human and computer, but it is very difficult to use FORTRAN and C/C++ are easier to be understood and used by humans compared to machine language but the computer does not understand it -> needs a compiler to convert them to object file (machine language form) Based on current problem (set-up), the difference between C++ and FORTRAN is just the syntax.

12 Procedural vs. Object Oriented Programming Procedural: need to know the details of each part of program to use the code program to use the code Object Oriented (OOP): just need to know at higher level to be able to use the code be able to use the code OOP is slightly less efficient in terms of running time versus procedural but easier to manage procedural but easier to manage Most research codes and libraries are written in procedural programming

13 What Scientific Programming can Do? Movie 23Movie 23 - P/H: Below Movie 23 Movie 5Movie 5, - Turning Circle Movie 5 Movie 57Movie 57 - Propeller Movie 57 Movie 68Movie 68 - Rough Sea Movie 68

14 First, need to understand The Generic approach of Programming to solve scientific or engineering problems -> Flow chart Concept of variables, identifiers, data type, C++ library Initialization, arrays and memory allocation Control structure and loops Function, subroutines, structures and classes

15 A Sample C++ Code #include //to include C++ library for input and output of values using namespace std; //to be able to use all the standard c using namespace std; //to be able to use all the standard classes, objects and functions in C++ int main () // start of program body, main is a function with no parameters that returns an int. value { int numberOfLanguages; // define an identifier numberOfLanguages as an integer data type int numberOfLanguages; // define an identifier numberOfLanguages as an integer data type cout << “Hello student.\n "; // program greets the student and go to next line cout << “Hello student.\n "; // program greets the student and go to next line << “Welcome to EMT 101.\n”; << “Welcome to EMT 101.\n”; cout << “How many programming languages have you used? "; // program asking user to input no of languages cout << “How many programming languages have you used? "; // program asking user to input no of languages cin >> numberOfLanguages; // input from user is now saved into numOfLanguages cin >> numberOfLanguages; // input from user is now saved into numOfLanguages return 0; // to return 0 as the integer value of main, most C++ compilers need this } // end of program body

16 Exercises Write a C++ program to enter your name and your student metric number.