Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Design Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.

Similar presentations


Presentation on theme: "Programming Design Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University."— 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 2Ku-Yaw ChangIntroduction Introduction Three types of programming languages Machine languages Strings of numbers giving machine specific instructions Strings of numbers giving machine specific instructions Example: Example:+1300042774+1400593419+1200274027 Assembly languages English-like abbreviations representing elementary computer operations (translated via assemblers) English-like abbreviations representing elementary computer operations (translated via assemblers) Example: Example: LOAD BASEPAY ADD OVERPAY STORE GROSSPAY

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

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

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

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

7 7Ku-Yaw ChangIntroduction Introduction Phases of C/C++ programs: Edit Edit Preprocess Preprocess Compile Compile Link Link Load Load Execute Execute

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

9 9Ku-Yaw ChangIntroduction MS Visual C++ Solution (*.sln) Consist of one or more projects (*.vcproj) Consist of one or more projects (*.vcproj) Project (*.vcproj) Consist of many modules Consist of many modulesModule *.cpp/*.h *.cpp/*.h *.lib *.lib

10 10Ku-Yaw ChangIntroduction MS Visual C++

11 11Ku-Yaw ChangIntroduction The First C Program In C, the program to print “hello, world” is #include #include 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

12 12Ku-Yaw ChangIntroduction 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.

13 13Ku-Yaw ChangIntroduction 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 \t for tab \b for backspace \b for backspace \” for double quote \” for double quote \\ for backslash \\ for backslash

14 The End


Download ppt "Programming Design Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University."

Similar presentations


Ads by Google