ch1_prelim_lab1_lab2.pdf

Upload: odie-mitzimum

Post on 06-Mar-2016

34 views

Category:

Documents


0 download

TRANSCRIPT

  • 1 | P a g e

    1

    5

    1. (Unit Analysis) 2. (Scientific Notation) 3. (Software development) 4. (Algorithm development)

    1.1 (Unit Analysis)

    ( ) ( ) 2 5

  • 2 | P a g e

    1.1

    Quantity International

    Symbol System (SI) Units English Engineering Units

    Time t seconds (s) seconds (sec) Length l meters (m) feet (ft) 1 m = 3.2808 ft Area A sq. meters (m2) sq. feet (ft2) 10.76 ft2 Volume V cubic meters (m3) cubic feet (ft3) 1m3 =35.31 ft3 Mass m kilograms (kg) pounds mass (lbm) 1 kg = 2.19 lbm Force F Newton (1 N =1 kg-

    m/s2) pounds-force (lbf =lbm-ft/sec2)

    1 lbf = 4.448 N

    Weight W Newton (N) pounds force (lbf) 1 lbf = 4.448 N Density kilograms/cubic

    meters (kg/m3) pounds-mass/cubic ft (lbm/ft3)

    1 lbf/ft3 =16.02 kg/m3

    Velocity v meters/sec (m/s) feet/sec (ft/sec) 1 m/s =3.2808 ft/sec Acceleration a meters/sec2 (m/s2) feet/sec2 (ft/sec2) 1 m/s2 =3.2808

    ft/sec2 Pressure P Pascal (Pa) (1 Pa =1

    N/m2) lbf/ft2 1 lbf/ft2 =47.88 Pa

    Heat transfer Q Joules (J) (1 J = 1N.m) British Thermal Unit (BTU)

    1 BTU = 1055 J

    Heat flux Q Joules/sec (J/s) (1J/s = 1 Watt)

    BTU/sec 1 BTU/sec =1055 J/s

    Work W Joules (J) ft-lbf 1 ft-lbf =1.356 J Power W Watts (W) (1 W =1 J/s) ft-lbf/sec 1 ft-lbf/sec =1.356 W Temperature T degrees Celsius (C)

    and degrees Kelvin (K)

    degrees Fahrenheit(F) and degrees Rankin (R)

    F = 1.8C + 32 = 9/5C + 32 C = (F - 32)/1.8 = 5/9 (F - 32) K = C + 273.15 R = F + 459.67 R = 1.8K C = (R - 491.67) / 1.8 = 5/9 (R - 491.67)

  • 3 | P a g e

    1.2 (Scientific Notation)

    299,792,458 ( 3 x108 ) 0.000100 (100 100 x 10-6 ) (Scientific notation) 3e08 100e-6 e Exponential notation

    1.2

    1.2

    Scientific Notation Symbol Name () Exponential notation 10-12 p pico () e-12 10-9 n nano () e-9 10-6 Micro () e-6 10-3 m milli () e-3 103 k kilo () e3 106 M mega () e6 109 G giga () e9 1012 T tera (-) e12

  • 4 | P a g e

    1.3 (Software development)

    1.1 (input) (process) (output)

    1.1

    5

    1. (Analyse the problem)

    2. input/output input output ,

    3. (Algorithm Development) input output (data) (steps) (flowchart) (pseudo code)

    4. (Hand example)

  • 5 | P a g e

    hand example

    5. (Coding and Testing) 3 4 4 ( ) (Backup) Cloud Services, Flash drive External Hard drives

    3 Integrated Development Environment (IDE) IDE

    1.4 (Algorithm development)

    (Flowchart) (pseudo code)

    (Flowchart)

    1.3

    1. 2. flow line diamond (decision)

    terminator 3. (connector) flow lines

    (Pseudo code)

  • 6 | P a g e

    (Reserve words) (Keywords) input, output, read, print, for, while, end

  • 7 | P a g e

    1.3

    Terminator Start/Stop /

    Input, Output

    Process

    , ,

    Decision

    Flow line

    /

    Connector flow

    lines

    Page connector

    1

    1.

    2. input/output input output

    3.

  • 8 | P a g e

    1.2 (Pseudo code) START GET width, length IF width and length than zero THEN area=width X length PRINT area END

    4. Hand Example 2.50 . 4.50 . 11.25 .. 5. Coding and Testing

  • 9 | P a g e

    Listing 1.1 ComputeArea\main.cpp

    #include

    using namespace std;

    int main()

    {

    double width=0, height=0, area;

    while ( (width==0)||(height==0))

    {

    cout > width;

    cout > height;

    }

    area=width*height;

    cout

  • 10 | P a g e

    1.4

    4. Hand Example

    -1 -1 0 -2 1 3

    5. Coding and Testing Listing 1.2 Example2\main.cpp

    #include

    using namespace std;

    int main()

    {

    int t, yt, n=0;

    while (n!=3)

    {

    cout t;

  • 11 | P a g e

    if(t

  • 12 | P a g e

    This page intentionally left blank.

  • 13 | P a g e

    1309 200 Computer Programming Laboratory

    1:

    Social Network Google Chrome Applications

    1. 2. Social Network 3. 4. (Algorithm) 5.

    Social Network Social Network Facebook Google Plus Social Network

    Google Google Chrome Apps Google Chrome Applications Gliffy Diagrams, Google Drive SourceLair Applications Lucidchart Diagrams, Cacoo-Diagram, Powerpoint, Daum Equation Chrome Web Store

  • 14 | P a g e

    1. Google Chrome Browser Google Account 2. Email Account 3. Facebook Account

    1

    Email ()

    Subject, CC/BCC, Body

    CC/Bcc (Body)

    [email protected] 1.6

    1.6 ( )

    dead mail inbox Sent Box

  • 15 | P a g e

    Sent Box

    [email protected] x 1 [email protected] 2 [email protected]

    Facebook Group and Google Plus Community

    (Social Network) Facebook Community Google Plus

    -

    Links Community

    https://www.facebook.com/groups/1309200compro/ https://plus.google.com/u/0/communities/107685445050170740529

    QR Codes

  • 16 | P a g e

    1.7 1.8 Community Google Plus

    1.7

    1.8 Google Plus Community

    Google Plus Community download (Course Syllabus)

    Chrome Web Store

    Chrome Web Store Google Chrome Browser Google Chrome Desktop Chrome Browser Sign-in Chrome Browser Google Account

  • 17 | P a g e

    Chrome Browser Sign-in Google Account Chrome Sign-in Google Account Google Account Chrome

    Chrome Browser Chrome App Launcher https://chrome.google.com/webstore/launcher Launcher 1.9

    1.9 Chrome App Launcher

    Launcher Chrome Apps Shortcut Launcher https://chrome.google.com/webstore/category/collections 1.10

  • 18 | P a g e

    1.10 Chrome Browser

    Chrome Browser Chrome Browser Sign-in account Store

    Gliffy Diagrams SourceLair Cacoo-Diagram Google Drawings Daum Equation Editor Lucidchart Diagrams

    Gliffy Diagrams

    Integrate Google Drive Google Drive Google Drawings, Lucidchart Diagrams, Cacoo-Diagram, MS-Office PowerPoint, MS-Visio, Dia

    Gliffy Diagrams option 1.11 Gliffy Diagrams

  • 19 | P a g e

    1.11 Gliffy Diagrams

    1.12 Gliffy Diagrams save .png [email protected] x

    1.12

  • 20 | P a g e

    Google Drive

    Cloud Storage Google Google Docs Cloud Storage Service Real-time Google Drive 1.13

    1.13 Google Drive

    Gliffy integration Gliffy diagrams Google Drive Google Drive Shortcut Launcher https://drive.google.com/ Drive Google Account

    1.14 Google Drive Gliffy Diagrams

  • 21 | P a g e

    1.12 share diagram [email protected] x

    SourceLair

    CPP, C, Python, Fortran Internet Browser Source code Compile () Link () Run () Browser 1.15 SourceLair

    1.15 SourceLair

    SourceLair 1.15 Output 1.16

    1.16 SourceLair

  • 22 | P a g e

    SourceLair Capture [email protected] x

    Consultation Booking ( )

    compro.youcanbook.me 24

    2 (Algorithm)

    6. 7. 8. 4

    1. Save .png [email protected] x

    2. Share Gliffy diagrams [email protected] x

    1309 200 Computer Programming Laboratory

    2 : Using Code::Blocks 10.xx

  • 23 | P a g e

    1. Code::Blocks 10.xx 2. (C++) Code::Blocks 10.xx 3. Compile & Run (C++) Code::Blocks 10.xx 4. (common errors) Code::Blocks

    10.xx

    IDE (Integrated Development Environment) IDE Text Editor IDE IDE IDE IDE IDE IDE eclipse, Code::Blocks, bloodshed, NetBeans, MS Visual Studio Express, CodeLite IDE IDE cross platform Open source Windows, Unix OS X source code

    IDE C++ Code::Blocks 10.xx IDE IDE Open source Editor Code::Blocks 10.xx auto complete keywords warning errors Code::Blocks cross platform IDE source code platform platform Windows Mac OS X Linux based OS.

    C++

  • 24 | P a g e

    3

    1. (Text Editor) 2. C++ (C++ Compiler) 3. (Linker)

    Windows

    1. Text Editor (Text File) Source Code .cpp

    2. .cpp C++ (C++ Compiler) .obj .cpp

    3. .obj (Linker) .exe

    Code::Blocks 10.xx

    C++ Compiler 3 pre-processing, compiling linking 1.1

    Programming Errors

    error 3 Syntax errors, Runtime errors Logic errors

    Syntax errors ; statement, Compile

    Runtime errors Compile Source code 0

    Logic errors (Listing 1.3)

  • 25 | P a g e

    Listing 1.3 ShowLogicErrors\main.cpp #include

    using namespace std;

    int main()

    {

    cout

  • 26 | P a g e

    1.17 C++ (Liang 2014)

  • 27 | P a g e

    Code::Blocks 10.xx Code::Blocks 4

    1.18 Code::Blocks Code::Blocks 4

    1. (Manu Bar) Code::Blocks

    2. (Management) Project Workspace Project Workspace source code

    3. (Editor Window)

    4. (Logs & others) errors warnings logs

    Code::Blocks

    (Menu Bar) Code::Blocks Alt+F File Menu

    File 1.19 File>New pull down menu 1.20

    xx

  • 28 | P a g e

    1.19 New file balloon New file

    1.20 pull down menu New file

    Project Project Console application 1.21

  • 29 | P a g e

    1.21 Console application

    Console application wizard application next 1.22

    1.22 console application wizard

    wizard coding C++ 1.23

  • 30 | P a g e

    1.23 C++ console application

    Next ( 12) 1.24

    1.24

  • 31 | P a g e

    Next Code::Blocks GNU GCC 1.25

    1.25 GNU GCC Compiler

    Finish management workspace Sources source code Code::Blocks main.cpp 1.26 main.cpp Sources

    1.26 Code::Blocks

    main.cpp editor management 1.27

  • 32 | P a g e

    1.27 main.cpp editor

    Editor Editor

    1. 2. 3.

    1. 2. 3.

    Edit 1. 2.

    Code::Blocks keywords Code::Blocks highlight Code::Blocks Code::Blocks

  • 33 | P a g e

    MyFirstProject\main.cpp

    Listing 1.4 MyFirstProject\main.cpp

    1: #include

    2: using namespace std;

    3: int main()

    4: {

    5: //Display Hello message to the console

    6: cout

  • 34 | P a g e

    standard input/output

    C++ main (statements) main 3 8 statements / ( { 4 } 8) statement C++ ; () statement

    5 compiler C++

    //This is a single line comment

    /* This is also a comment */

    /* This is how we make

    multiple lines comments */

    6 Hello world! Console cout object ( ) Console output

  • 35 | P a g e

    1

    1. C: 2. ComProXXXX XXXX 3. 4. save Windows Explorer 1.28

    1.28

    2 C++ Code::Blocks

    1. Code::Blocks 1.18

    2. management workspace workspace File > close all projects 1.29

  • 36 | P a g e

    1.29 workspace

    3. MyIntroduction, IntroduceMyself main.cpp code 1.27

    4. main.cpp Code::Blocks Code::Blocks compile, Build and Run 1.30

  • 37 | P a g e

    1.30 Compile, Build and run

    5. Build and run DOS command (Console) 1.31 active

    1.31 MyFirstProject

    *** Code::Blocks Build and run greyed out 1.32

  • 38 | P a g e

    1.32 Compile, Build and run greyed out

    6. 1.33 XXX YYY 1234567 Electrical engineering Chemical Engineering Civil Engineering Industrial Engineering Mechanical Engineering

    1.33

    7. main.cpp

    Listing 1.5 MyFirstProject\main.c

  • 39 | P a g e

    #include

    using namespace std;

    int main()

    {

    cout

  • 40 | P a g e

    int main()

    {

    cout

  • 41 | P a g e

    This page intentionally left blank.