1 / 14

Programming Design

Programming Design. Ku-Yaw Chang canseco@mail.dyu.edu.tw Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University. Introduction. Three types of programming languages Machine languages Strings of numbers giving machine specific instructions

ghalib
Download Presentation

Programming Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming Design Ku-Yaw Chang canseco@mail.dyu.edu.tw Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University

  2. Introduction Three types of programming languages • Machine languages • Strings of numbers giving machine specific instructions • Example: • +1300042774 • +1400593419 • +1200274027 • Assembly languages • English-like abbreviations representing elementary computer operations (translated via assemblers) • Example: • LOAD BASEPAY • ADD OVERPAY • STORE GROSSPAY Introduction

  3. Introduction • High-level languages • Codes similar to everyday English • Use mathematical notations (translated via compilers) • Example: • grossPay = basePay + overTimePay Introduction

  4. Introduction • C • A general-purpose, high-level programming language • A system programming language • Writing compilers and operating systems • Unix, Linux, Windows…. • Hardware independent (portable) • Stem from • BCPL by Martin Richards • B by Ken Thompson • Both are “typeless” language • Provide a variety of data types • characters, integers and floating numbers Introduction

  5. Introduction • ANSI C • In 1983, the American National Standards Institute (ANSI) established a committee to provide a modern, comprehensive definition of C • Completed late in 1988 • Most of the features are supported modern compilers • ANSI/ISO C • ANSI/ISO 9899:1990 Introduction

  6. Introduction • C++ • Superset of C developed by Bjarne Stroustrup at Bell Labs • "Spruces up" C, and provides object-oriented capabilities • Object-oriented design very powerful • 10 to 100 fold increase in productivity • Dominant language in industry and academia • Learning C++ • Because C++ includes C, some feel it is best to master C, then learn C++ Introduction

  7. Introduction • Phases of C/C++ programs: • Edit • Preprocess • Compile • Link • Load • Execute Introduction

  8. Preprocessor Linker Editor Disk Disk Disk Disk Disk . . . . . . . . . . . . Preprocessor program processes the code. Compiler creates object code and stores it on disk. Compiler Linker links the object code with the libraries. Primary Memory Loader Loader puts program in memory. Primary Memory CPU CPU takes each instruction and executes it, possibly storing new data values as the program executes. Introduction

  9. MS Visual C++ • Solution (*.sln) • Consist of one or more projects (*.vcproj) • Project (*.vcproj) • Consist of many modules • Module • *.cpp/*.h • *.lib Introduction

  10. MS Visual C++ Introduction

  11. In C, the program to print “hello, world” is #include <stdio.h> main() { printf(“hello, world\n”); } include information about standard library define a function named main that receives no argument values Statements of main are enclosed in braces main calls library function printf to print this sequence of characters;\n represents the newline character The First C Program Introduction

  12. Exercise 1-1 • Run the “hello, world” program on your system. Experiment with leaving out parts of the program, to see what error messages you get. Introduction

  13. Exercise 1-2 • Experiment to find out what happens when printf’s argument string contains \c, where c is some character not listed above. • \t for tab • \b for backspace • \” for double quote • \\ for backslash Introduction

  14. The End

More Related