0% found this document useful (0 votes)
38 views31 pages

CENG103 Week1 LN

This document provides information about the CENG 103 - Computer Programming I course taught by Dr. Akif Hacınecipoğlu and teaching assistants. The course objective is to introduce programming constructs and basic data structures in C language. Students will be graded based on homeworks, labs, midterm, and final exams. The document also provides background information on computers, algorithms, programming languages, and an introduction to C programming.

Uploaded by

Seid Dibirov
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views31 pages

CENG103 Week1 LN

This document provides information about the CENG 103 - Computer Programming I course taught by Dr. Akif Hacınecipoğlu and teaching assistants. The course objective is to introduce programming constructs and basic data structures in C language. Students will be graded based on homeworks, labs, midterm, and final exams. The document also provides background information on computers, algorithms, programming languages, and an introduction to C programming.

Uploaded by

Seid Dibirov
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

CENG 103 – Computer Programming I

Week 1

Dr. Akif Hacinecipoglu


People

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?

Why do we need a programming language?


• We need to tell the computer to do something.
• Computers have a special way of executing requests.
• There are lots of different programming languages but at the end they do nearly the same
thing.

Why do we learn programming with C language?


• C provides deeper understanding of how programming languages work.
• C is a basic language you may encounter in your professional engineering life.
• C has better access and control on hardware and memory.
• C is a powerful language. If you are comfortable with C you can learn any other language
as well.
Computers

Computer is a device that can perform computations and make logical


decisions billions of times faster than human beings can.

Computers process data under the control of sets of instructions called


computer programs. These programs guide the computer through orderly
sets of actions specified by people called computer programmers.

Hardware: A computer consists of various devices referred to as hardware


(e.g., the keyboard, screen, mouse, hard disk, memory, DVDs and
processing units).
Software: The programs that run on a computer are referred to as software
Computers

Computer consists of
• Input unit
• Output unit
• Memory unit
• Arithmetic and logic unit (ALU)
• Central processing unit (CPU)
• Secondary storage unit
Computers

Logical organization of a computer


• 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

Arithmetic and logic unit (ALU)


Performs calculations, such as addition, subtraction, multiplication and division. It
also contains the decision mechanisms that allow the computer, for example, to
compare two items from the memory unit to determine whether they’re equal.
In today’s systems, the ALU is usually implemented as part of the next logical unit,
the CPU.
Computers

Central processing unit (CPU)


Administrative section which coordinates and supervises the operation of the other
sections. The CPU tells the input unit when to read information into the memory unit,
tells the ALU when information from the memory unit should be used in calculations
and tells the output unit when to send information from the memory unit to certain
output devices.

Many of today’s computers have multiple CPUs and, hence, can perform many
operations simultaneously
Computers

Secondary storage unit


This is the long-term, high-capacity storage section. Programs or data not actively
being used by the other units normally are placed on secondary storage devices
(e.g., your hard drive) until they’re again needed, possibly hours, days, months or
even years later. Therefore, information on secondary storage devices is said to be
persistent - it is preserved even when the computer’s power is turned off.

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.”

Algorithm is collection of steps to achieve a goal (generally solving a real world


problem).

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

What is a computer program?


“A computer program is a collection of instructions that can be executed by a
computer to perform a specific task.”

Programs can be written in wide variety of programming languages.

There are different types of programs for different purposes.


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.

Machine languages generally consist of strings of numbers (ultimately reduced to 1s


and 0s) that instruct computers to perform their most elementary operations one at a
time.

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

High Level Languages


To speed the programming process, high-level languages were developed in which
single statements could be written to accomplish substantial tasks.

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

Source codes written using programming languages


are subject to a specific pipeline to become an
executable program. We call this "compilation
pipeline".

Many programming languages (like C, C++, Visual


Basic, Fortran, Go, etc.) are subject to this pipeline,
consisting of pre-processing, compiling, assembling,
linking, loading and executing steps.

Some other programming languages (like Python,


Perl, Javascript, etc.) are interpreted languages.
They require an interpreter (which is written in
another compiled language) to run.
C Programming Language

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

Why do we learn programming with C language?


• C provides deeper understanding of how programming languages work.
• C is a basic language you may encounter in your professional engineering life.
• C has better access and control on hardware and memory.
• C is a powerful language. If you are comfortable with C you can learn any other language as
well.

Why not Python?


• Python is an interpreted language. It does not reflect compilation pipeline which is important
to understand.
• Python is easy to learn and write however, it is not suitable for large (also hardware related)
projects.
• It is excellent language for rapid prototyping especially for artificial intelligence applications.
• It is better to learn Python after learning programming basics with C.
C Programming Language

Are C and C++ the same language?


• No. C is not C++.
• However, C is the foundation for development of C++.
• C is a procedural language while C++ is an object oriented language also
supporting procedural programming.
• Modern operating systems, games and large projects like autonomous vehicles
heavily developed using C++.
• Learning C is an important step in learning C++.
• Computer Engineering students will take CENG 104 in next semester to learn C++
also.
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

• Linux is a family of UNIX-like operating systems using Linux kernel.


• First developed in 1991 by Linus Torvalds.
• Open source operating system.
• There are different distributions using Linux kernel.
• Most widely used distribution is Ubuntu OS.
• You can try Ubuntu 20.04 from www.ubuntu.com
• Linux is very widely used in research and development.
• It is advantageous to be proficient in Linux especially if you are CS or
Computer Engineering student.
C Programming Language

As an editor, you can use any text editor to write your


code.

IDE (Integrated Development Environment) is a


software for program development. It makes it easier
to organize and compile your code.

You can use DevC/C++ IDE in Windows.


You can use gcc compiler in Linux.
C Programming Language

You might also like