Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fundamental Programming: 20061 310201 Fundamental Programming K.Chinnasarn, Ph.D.

Similar presentations


Presentation on theme: "Fundamental Programming: 20061 310201 Fundamental Programming K.Chinnasarn, Ph.D."— Presentation transcript:

1 Fundamental Programming: 20061 310201 Fundamental Programming K.Chinnasarn, Ph.D. ckrisana@gmail.com

2 Fundamental Programming: 20062 Session times Lectures Workshops

3 Fundamental Programming: 20063 Resources Textbook –CPP-tutorial.pdf Available at http://www.cplusplus.com/doc/tutorial/ –Structured and Object-Oriented Programming, Staugaard, 3 rd edition Study Guides Software –G++ based on Linux OS

4 Fundamental Programming: 20064 Essential resources Web page for the subject – find from –http://www.cs.buu.ac.th/~krisana –check at least TWICE EACH WEEK Email –TO ckrisana@gmail.com –Topic: 310201 studentID

5 Fundamental Programming: 20065 Assessment Three assignments –20%, due Week 5 –40%, due Week 8 –40%, due Week 12 Online assignment submission No examination

6 Fundamental Programming: 20066 Plagiarism & Deadlines & Extensions Plagiarism of any kind is not permitted Penalties will be applied Extensions must be requested before the deadline Requests must be in writing (email is fine)

7 Fundamental Programming: 20067 In this course...  in Fundamental Programming, you will learn how to design, code and test simple programs  in this course we develop “structured programs” – programs broken into chunks to make them easier to understand  we do not cover “object-oriented programming” - that comes later  a program is a piece of software - a few things about software...

8 Fundamental Programming: 20068 Goals of this Course Introduce general concepts of programming Begin to thing like a programmer Learn to appreciate programming and computer science Start programming in C++

9 Fundamental Programming: 20069 What is programming? Given a problem: –Find an algorithm to solve a problem. –Express that algorithm in a way that the computer can execute it.

10 Fundamental Programming: 200610 Algorithms In simple terms, an algorithm is a sequence of instructions to solve a problem, such that: –Each instruction is unambiguous, and is something the computer can do. –After an instruction is finished, there is no ambiguity about which instruction is to be executed next. –Execution finishes in a finite number of steps. –The description of the algorithm is finite. Think of the computer as a meticulous moron.

11 Fundamental Programming: 200611 Software  Software sits between the user and the hardware  it enables the user to do something useful with the hardware  some pieces of software are very big – Windows 2000  30 million lines of code  15 million of which are new  Windows 2000 is a collection of programs that work together – one is File Explorer

12 Fundamental Programming: 200612 Software

13 Fundamental Programming: 200613 Software  Windows also has components that can be used by other programs  Microsoft Word uses the file services component of the operating system to read data from files, and write data to files  most programs use other software to perform their task(s)...

14 Fundamental Programming: 200614 Software Hardware Operating System File Explorer File Services WinWord.exe

15 Fundamental Programming: 200615 Computers  computers are data processing devices  main input device: keyboard  main output device: display  processor performs operations on input data to produce output data

16 Fundamental Programming: 200616 Computers

17 Fundamental Programming: 200617 Programs Number of marks in exam ==> 50 Student's mark ==> 30 Student's percentage: 60

18 Fundamental Programming: 200618 Programs output “Number of marks in exam ==> “ to display input number from keyboard - store in M1 output “Student’s mark ==> “ to display input number from keyboard - store in M2 divide number in M2 by number in M1 - store in M3 multiply number in M3 by 100 - store in M4 output “ Student’s percentage: “ to display output number in M4 to display

19 Fundamental Programming: 200619 Programs output “Number of marks in exam ==> “ to display input number from keyboard - store in M1 output “Student’s mark ==> “ to display input number from keyboard - store in M2 divide number in M2 by number in M1 - store in M3 multiply number in M3 by 100 - store in M4 output “ Student’s percentage: “ to display output number in M4 to display M1:? M2:? M3:? M4:? =>

20 Fundamental Programming: 200620 Programs Number of marks in exam ==>

21 Fundamental Programming: 200621 Programs output “Number of marks in exam ==> “ to display input number from keyboard - store in M1 output “Student’s mark ==> “ to display input number from keyboard - store in M2 divide number in M2 by number in M1 - store in M3 multiply number in M3 by 100 - store in M4 output “ Student’s percentage: “ to display output number in M4 to display M1:? M2:? M3:? M4:? =>

22 Fundamental Programming: 200622 Programs Number of marks in exam ==>

23 Fundamental Programming: 200623 Programs Number of marks in exam ==> 50

24 Fundamental Programming: 200624 Programs output “Number of marks in exam ==> “ to display input number from keyboard - store in M1 output “Student’s mark ==> “ to display input number from keyboard - store in M2 divide number in M2 by number in M1 - store in M3 multiply number in M3 by 100 - store in M4 output “ Student’s percentage: “ to display output number in M4 to display M1:? M2:? M3:? M4:? =>

25 Fundamental Programming: 200625 Programs output “Number of marks in exam ==> “ to display input number from keyboard - store in M1 output “Student’s mark ==> “ to display input number from keyboard - store in M2 divide number in M2 by number in M1 - store in M3 multiply number in M3 by 100 - store in M4 output “ Student’s percentage: “ to display output number in M4 to display M1:50 M2:? M3:? M4:? =>

26 Fundamental Programming: 200626 Programs Number of marks in exam ==> 50 Student's mark ==>

27 Fundamental Programming: 200627 Programs output “Number of marks in exam ==> “ to display input number from keyboard - store in M1 output “Student’s mark ==> “ to display input number from keyboard - store in M2 divide number in M2 by number in M1 - store in M3 multiply number in M3 by 100 - store in M4 output “ Student’s percentage: “ to display output number in M4 to display M1:50 M2:? M3:? M4:? =>

28 Fundamental Programming: 200628 Programs Number of marks in exam ==> 50 Student's mark ==>

29 Fundamental Programming: 200629 Programs Number of marks in exam ==> 50 Student's mark ==> 30

30 Fundamental Programming: 200630 Programs output “Number of marks in exam ==> “ to display input number from keyboard - store in M1 output “Student’s mark ==> “ to display input number from keyboard - store in M2 divide number in M2 by number in M1 - store in M3 multiply number in M3 by 100 - store in M4 output “ Student’s percentage: “ to display output number in M4 to display M1:50 M2:? M3:? M4:? =>

31 Fundamental Programming: 200631 Programs output “Number of marks in exam ==> “ to display input number from keyboard - store in M1 output “Student’s mark ==> “ to display input number from keyboard - store in M2 divide number in M2 by number in M1 - store in M3 multiply number in M3 by 100 - store in M4 output “ Student’s percentage: “ to display output number in M4 to display M1:50 M2:30 M3:? M4:? =>

32 Fundamental Programming: 200632 Programs output “Number of marks in exam ==> “ to display input number from keyboard - store in M1 output “Student’s mark ==> “ to display input number from keyboard - store in M2 divide number in M2 by number in M1 - store in M3 multiply number in M3 by 100 - store in M4 output “ Student’s percentage: “ to display output number in M4 to display M1:50 M2:30 M3:0.6 M4:? =>

33 Fundamental Programming: 200633 Programs output “Number of marks in exam ==> “ to display input number from keyboard - store in M1 output “Student’s mark ==> “ to display input number from keyboard - store in M2 divide number in M2 by number in M1 - store in M3 multiply number in M3 by 100 - store in M4 output “ Student’s percentage: “ to display output number in M4 to display M1:50 M2:30 M3:0.6 M4:60 =>

34 Fundamental Programming: 200634 Programs Number of marks in exam ==> 50 Student's mark ==> 30 Student's percentage:

35 Fundamental Programming: 200635 Programs output “Number of marks in exam ==> “ to display input number from keyboard - store in M1 output “Student’s mark ==> “ to display input number from keyboard - store in M2 divide number in M2 by number in M1 - store in M3 multiply number in M3 by 100 - store in M4 output “ Student’s percentage: “ to display output number in M4 to display M1:50 M2:30 M3:0.6 M4:60 =>

36 Fundamental Programming: 200636 Programs Number of marks in exam ==> 50 Student's mark ==> 30 Student's percentage: 60

37 Fundamental Programming: 200637 Programs output “Number of marks in exam ==> “ to display input number from keyboard - store in M1 output “Student’s mark ==> “ to display input number from keyboard - store in M2 divide number in M2 by number in M1 - store in M3 multiply number in M3 by 100 - store in M4 output “ Student’s percentage: “ to display output number in M4 to display M1:50 M2:30 M3:0.6 M4:60 =>

38 Fundamental Programming: 200638 Data  we said that “data” is numbers and text  data is stored as strings of 1s and 0s  standard unit of storage is a byte - 8 bits  numbers are stored in binary form: 1 is stored as 00000001, 2 is stored as 00000010, 3 is stored as 00000011, etc...  the ASCII coding system is used for text: a is stored as 01100001, A is stored as 01000001, b is stored as 01100010, B is stored as 01000010, c is stored as 01100011, etc...

39 Fundamental Programming: 200639 Data  two main data storage areas in a computer:  memory  disk  main differences:  (main) memory:  fast, but expensive,  volatile - data lost when power turned off  (secondary memory) disk:  slow, but cheap  persistent - data retained when power turned off

40 Fundamental Programming: 200640

41 Fundamental Programming: 200641 Languages  processors perform very simple operations  most programs are written in high-level languages (C++, Visual Basic, COBOL, etc)  each high-level language statement translates to several machine code statements  a compiler converts the high-level language statements to machine code statements  programs are written in a high-level language as they are easier to code and understand

42 Fundamental Programming: 200642 Language Translators: Interpreter Program Statement+Data Interpreter Machine language statement Statement execution

43 Fundamental Programming: 200643 Language Translators (Compilers) Step1: Convert program (Compile Time) Step2: Execute program (Run time) Computer program Compiler Machine language Program Machine language program Data Program Output

44 Fundamental Programming: 200644 Program Development cycle Design Edit: vi, emacs, tools Compile and link: gcc 1.Preprocessor 2.Compiler 3.Linker Execute:./a.exe 1.Loader 2.Your program!

45 Fundamental Programming: 200645 Software Development  when you code a program in C++, it is easy to make mistakes that cause compiler errors  but this task is only a small part of s/w development process  before coding a program, it must be designed  if the design is going to work, the task the program will perform must be understood  the Study Guide describes a 5-step software development process

46 Fundamental Programming: 200646 Software Development  task analysis and specification  analysis the task(s) the program must perform and produce a written statement of the requirements  algorithm design  develop the logic that the program will perform to accomplish it’s task(s)  coding  testing  it must do what you want (no bugs) - verification  it must do what the client wants - validation  maintenance

47 Fundamental Programming: 200647 Software Development  by “maintenance” we mean:  fixing bugs – distributed as Service Release  making improvements - eg. Win95 user interface  changes/extensions - eg. Win98 support for USB  around 75% of programming time is spent maintaining software – so it’s important to use simple designs that are easy to understand  important: coding is just a small part of the software development process - analysis, design and testing are more important steps in the process

48 Fundamental Programming: 200648 SDLC  Study Guide talks about a software development life cycle - SDLC  idea is that each version of a program involves a rotation through the 5 stages analysis and specification algorithm design codingtesting maintenance

49 Fundamental Programming: 200649 Summary  in 310201 you will design & code C++ programs  a program is a piece of software  computers input, process and output data  a compiler translates C++ into machine code  coding is a small part of development process  analysis, design and testing more important  use simple designs to reduce maintenance  Study Guide describes a 5-step SDLC


Download ppt "Fundamental Programming: 20061 310201 Fundamental Programming K.Chinnasarn, Ph.D."

Similar presentations


Ads by Google