CENG103 Week1 LN
CENG103 Week1 LN
Week 1
Instructor
Dr. Akif Hacınecipoğlu ([email protected])
Teaching Assistants
Ayşegül Doğruoğlu ([email protected])
Aybüke Bozkurt ([email protected])
Course Information - Computer Programming I
Objective
This course gives a brief introduction to programming language constructs, solving
algorithmic problems, and basic data structures in C. It is designed as a first course of
programming and supported by laboratory sessions for students in Computer Engineering,
Electrical and Electronics Engineering and Mechanical Engineering major.
Textbook
"C: How to Program", Paul Deitel, Harvey Deitel, Sixth Edition, 2009
Course Information - Computer Programming I
Grading (Tentative)
Homeworks %10
Laboratory Assignments %10
Midterm Exam %30
Final Exam %45
Attendance (to live sessions) %5
Notes
• Each work will be individual assignment. Working in groups are not allowed.
• You must follow general code of ethics for universities.
• Follow Distance Education Center for updates about the course.
Why?
Computer consists of
• Input unit
• Output unit
• Memory unit
• Arithmetic and logic unit (ALU)
• Central processing unit (CPU)
• Secondary storage unit
Computers
Input Unit
Obtains information (data and computer programs) from input devices and
places it at the disposal of the other units so that it can be processed.
Examples:
Keyboards, mouse devices, microphones, scanners, barcode readers, USB
flash drives, etc.
Computers
Output Unit
Takes information that the computer has processed and places it on various
output devices to make it available for use outside the computer.
Examples:
Screens, printers, headphones, etc.
Computers
Memory Unit
Rapid-access, relatively low-capacity section. Memory unit retains information that
has been entered through the input unit, making it immediately available for
processing when needed. The memory unit also retains processed information until it
can be placed on output devices by the output unit.
Information in the memory unit is volatile -it’s typically lost when the computer’s
power is turned off.
Computers
Many of today’s computers have multiple CPUs and, hence, can perform many
operations simultaneously
Computers
Examples:
Hard drives, solid state drives, etc
Algorithms and Programming
What is an algorithm?
“Starting from an initial state and initial input, the instructions describe a computation
that, when executed, will proceed through a finite number of well-defined successive
states, eventually producing "output" and terminating at a final ending state.”
Examples:
• Following directions
• Adding two numbers
• Finding Greatest Common Divisor
Algorithms and Programming
Algorithms and Programming
There are absolutely many ways (algorithms) for executing a task. Always think about
alternatives.
Algorithms and Programming
Algorithms and Programming
Operating Systems
• Linux,
• Windows,
• Android,
• MacOS,
• etc.
Application Software
• Games
• Microsoft Office Applications
• Web Browsers (Chrome, Firefox, etc.)
Algorithms and Programming
Machine Language
Any computer can directly understand only its own machine language. Machine
language is the “natural language” of a computer and as such is defined by its
hardware design.
Assembly Language
Machine-language programming was simply too slow, tedious and error prone for
most programmers. Instead of using the strings of numbers that computers could
directly understand, programmers began using English-like abbreviations to
represent elementary operations. These abbreviations formed the basis of assembly
languages.
Algorithms and Programming
C, C++, Microsoft’s .NET languages (e.g., Visual Basic, Visual C++ and Visual C#)
and Java are among the most widely used high-level programming languages.
Algorithms and Programming
Compilation Pipeline
History of C
• Developed by Denis M. Ritchie at AT&T Bell Labs in 1972 as a systems
programming language
• Used to develop UNIX
• Used to write modern operating systems
• Hardware independent (portable)
• Standard (ANSI C) created in 1989, updated in upcoming years.
C Programming Language
• Problem Definition
• Purpose, Inputs, Outputs (Requirements Engineering)
• Program Design
• Devise an algorithm (clearly defined steps to produce output from input)
• Top-down design, stepwise refinement
• Program Coding
• Express algorithm in a programming language
• Program Compilation and Execution
• Translate to machine code: (preprocess,) compile, link
• Program Testing and Debugging
• Desk checking, compile-time errors, run-time errors, logical errors
• Program Documentation
• Requirements, input/output, top-down design, algorithms, source, tests, user’s guide
• Self-documenting, comments
Linux