29
ME 240 Computation for Mechanical Engineering Lecture 1 Introduction to the course 1

Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

ME 240

Computation for Mechanical

Engineering

Lecture 1

Introduction to the course

1

Page 2: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Web Resources for the Course

Course Web Page www.gantep.edu.tr/~kanber/ME240

C++ Resources Network: www.cplusplus.com

C++ Reference: www.cppreference.com

Also search Google and Wikipedia for any

of the expressions used in this course.

2

Page 3: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Course Books

Programming with C++,

John R. Hubbard Schaum Outline Series (2000)

Essential C++ for Engineers and Scientists,

Jeri R. Hanly, Pearson Education (2002)

3

Guide to Scientific Computuing in C++

Joe Pitt-Francis and Jonathan Whiteley,

Springer (2012)

Page 4: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Course Content

4

Introduction to the course and computer 11-02-2015

C++ Structure and programming 12-02-2015

C++ Data types 18-02-2015

C++ operators, intrinsic functions,

and strings 19-02-2015

Control structures: Selection-I 25-02-2015

Computer Lab-1 26-02-2015

Control structures: Selection-II 04-03-2015

Computer Lab-2 05-03-2015

Control structures: Repetitive structures-I 11-03-2015

Computer Lab-3 12-03-2015

Control structures: Repetitive structures-II 18-03-2015

Computer Lab-4 19-03-2015

Formatted I/O and File processing 25-03-2015

Computer Lab-5 26-03-2015

Review 01-04-2015

MIDTERM-1 02-04-2015

Page 5: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

5

Functions I:

Introduction and Basics (Part I) 08-04-2015

Computer Lab-6 09-04-2015

Functions II:

Introduction and Basics (Part II) 15-04-2015

Computer Lab-7 16-04-2015

One-dimensional Arrays 22-04-2015

Multi-dimensional Arrays 29-04-2015

Computer Lab-8 30-04-2015

Vectors 06-05-2015

Computer Lab-9 07-05-2015

Programming with Arduino 13-05-2015

MIDTERM-2 14-05-2015

Page 6: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Lectures, Labs, Attendance, Exams

Wednesday

two-hour programming session 10:30-12.20 in BIM lab 3 and 4 for first education

two-hour programming session 18:50-20.35 in BIM lab 3 and 4 for second education

Thursday two-hour programming session 8:30-10.20 in BIM lab 3 and 4 for first

education two-hour programming session 17:00-18.45 in BIM lab 3 and 4 for

second education

Attendance You must attend at least 70% of the course

Exams All are written exams First midterm 20% Second midterm 20% Quizes 20% Final 40%

6

Page 7: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Compiler and Computer Labs

We will learn C++ using the Orwell Dev-C++ compiler under Windows

It is free compiler and you can download from

http://sourceforge.net/projects/orwelldevcpp/

Every week you should write a few programs yourself in the BIM lab (and more in your free time).

In the BIM Computer Labs your programs will be deleted when the computer restarted. So you need to save them on a flash drive or on the internet.

If you have a Smartphone, you can download and install

CppDroid from PlayStore. Then you can check your C++

program at anywhere you want.

Page 8: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

The Computer

A computer is a machine that manipulates data according to

a set of instructions.

The first computers were developed in 1940–1945, they were very large in size!

Modern computers are based on integrated circuits making them very fast and small in size.

8

Page 9: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Parts of a Digital Computer

A computer can be divided into two main parts:

Hardware and Software.

Hardware (=Donanım)

See http://en.wikipedia.org/wiki/Hardware

Hardware is the electronic and

mechanical parts of the computer.

- Storage Units

- Input Units

- Output Units

- Process Units

9

Page 10: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Parts of a Digital Computer

Storage Units

These are used in both input and output of data:

HDD (“Hard Disk Drive”) SSD(“Solid State Disk”)

– high capacity – moderately high capacity

– relatively cheap – very expensive

– slow – very very fast

RAM (“Random Access Memory”)

– low capacity, expensive, but very fast.

Others:

Flash memory (memory cards, USB flash drives), CD, DVD...

10

Page 11: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

HDD (“Hard Disk Drive”)

11

A hard disk drive is a device for storing and retrieving digital

information, primarily computer data.

It consists of one or more rigid (hence "hard") rapidly

rotating discs (platters) coated with magnetic material, and

with magnetic heads arranged to write data to the surfaces

and read it from them

Page 12: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

RAM (“Random Access Memory”)

12

Random-Access Memory (RAM)

device allows stored data to be

accessed in very nearly the same

amount of time for any storage

location, so data can be accessed

quickly in any random order.

SDR-RAM DDR-RAM

DDR II-RAM

DDR III-RAM

RD-RAM

Page 13: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

13

Flash memory (memory cards, USB flash

drives), CD, DVD...

A USB flash drive is a data storage device that includes flash memory with an integrated Universal Serial Bus (USB) interface.

Secure Digital or (SD) is a non-volatile memory card format for use in portable devices.

The Compact Disc, or CD for short, is an optical disc used to store digital data.

Page 14: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Parts of a Digital Computer

Input Units

Used for input of data:

Keyboard,

Mouse

Touch screen/pad

RAM,

HDD

Flash memory…

14

Page 15: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

15

Keyboard

A keyboard is a typewriter-style device, which uses an arrangement of

buttons or keys, to act as mechanical levers or electronic switches

Q- keyboard

F- keyboard

Page 16: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

16

Mouse

A mouse is a pointing device that functions by detecting two-dimensional

motion relative to its supporting surface

Optical Mouse Roller Mouse Mechanical

Mouse

Page 17: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

17

Touch screen/pad

A touchpad (or trackpad) is a pointing device featuring a tactile sensor, a

specialized surface that can translate the motion and position of a user's

fingers to a relative position on screen.

Touch Screen Touchpad-

Laptop

Page 18: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Parts of a Digital Computer

Output Units

Used for output of data:

Monitor

Printer

Speaker

RAM

HDD

Flash Memory

18

Page 19: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

19

Monitor

A monitor or display (also called screen or visual display unit) is an

electronic visual display for computers.

LCD-LED Monitor CRT Monitor

Page 20: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

20

Printer

A hardware device used to print "hard copies" of documents created or

stored on the computer.

Dot matrix, ink jet, bubble jet, and laser are some of the types of available

printers

Laser Dot Matrix Ink Jet

Page 21: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

21

Speaker

A loudspeaker or speaker, is an electromechanical transducer which

converts an electrical signal into sound

Page 22: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Parts of a Digital Computer

Process Units

CPU: Central Processing Unit

This coordinates the operation of computer system

and performs arithmetic logic operations.

Input unit CPU Output unit

22

Page 23: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Parts of a Digital Computer

Data is input from a keyboard(3) which is again stored in RAM(4).

The CPU operates on the program and data in RAM(5) and

outputs results to the HDD(6) as well as the monitor(7).

This is all controlled by the CPU requiring only basic

data flow instructions from the programmer.

23

Page 24: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Parts of a Digital Computer

Software (=Yazılım)

See http://en.wikipedia.org/wiki/Software

Software consists of programs loaded from storage units.

The programs execute on the computer hardware forming,

for example,

Operating System (OS)

Compilers

Application Programs

24

Page 25: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Operating System (OS)

The OS is a program written to interface between the computer and it’s user. All other software runs under the OS.

Examples are:

Miscrosoft Windows (XP, Vista, 7,8)

Linux (e.g. Redhat, Ubuntu, Pardus)

Mac OS X.

25

Page 26: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Compilers

Many programming languages require a

compiler to translate the statements of

program written in a high level language into

a low level language (machine code).

In this course we will use Dev C++ compiler

to obtain the executable forms of our

programs.

Ms. Visual Studio and Borland C++ can also

be used for compiling our C++ programs

26

Page 27: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Application Programs

These are (usually compiled) programs written to perform a specific task.

Examples are:

Microsoft Word

AutoCAD,

SolidWorks

Catia

ANSYS

27

Page 28: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

An Engineer and Computers

Engineers use computers extensively

to produce and analyze designs;

to simulate and test how a machine, structure, or system operates;

to generate specifications for parts;

to monitor the quality of products; and

to control the efficiency of processes

28

Page 29: Lecture 1 - gaunmakine.files.wordpress.com · and strings 19-02-2015 Control structures: Selection-I 25-02-2015 ... We will learn C++ using the Orwell Dev-C++ compiler under Windows

Computer Languages

29

Language Application Area Origin of Name

Fortran Scientific programming Formula translation

COBOL Business data processing Common Business-Oriented Language

Lisp Artificial intelligence (AI) List processing

C Systems programming Predecessor language was named B

Prolog Artificial intelligence Logic programming

Ada Real-time distributed systems Ada Augusta Byron collaborated with

nineteenth-century computer pioneer

Charles Babbage

Smalltalk Graphical user interfaces;

object-oriented programming

Objects "talk" to one another via

messages

C++ Supports objects and

object-oriented programming

Incremental modification of C (++ is

the C increment operator)

Java Supports Web programming Originally named "Oak"