Download Unit 1 - 18CSS101J Programming for Problem Solving and more Slides Programming for Engineers in PDF only on Docsity!
18CSS101J – Programming for Problem Solving
Unit I
INSTITUTE OF SCIENCE AND TECHNOLOGY,
CHENNAI.
INSTITUTE OF SCIENCE AND TECHNOLOGY,
CHENNAI.
COURSE LEARNING RATIONALE (CLR)
The purpose of learning this course is to:
CLR -1:
Think and evolve a logically to construct an algorithm into a flowchart and a pseudocode that can be programmed
CLR -2:
Utilize the logical operators and expressions to solve problems in engineering and real-time
CLR -3: Store and retrieve data in a single and multidimensional array
CLR -4:
Utilize custom designed functions that can be used to perform tasks and can be repeatedly used in any application
CLR -5:
Create storage constructs using structure and unions. Create and Utilize files to store and retrieve information
CLR -6:
Create a logical mindset to solve various engineering applications using programming constructs in C
LEARNING RESOURCES S. No (^) TEXT BOOKS
Zed A Shaw, Learn C the Hard Way: Practical Exercises on the Computational
Subjects You Keep Avoiding (Like C), Addison Wesley, 2015
W. Kernighan, Dennis M. Ritchie, The C Programming Language, 2nd ed.
Prentice Hall, 1996
3. Bharat Kinariwala, Tep Dobry, Programming in C, eBook
4. http://www.c4learn.com/learn-c-programming-language/
INSTITUTE OF SCIENCE AND TECHNOLOGY,
CHENNAI.
UNIT I
INTRODUCTION
Evolution of Programming & Languages - Problem Solving
through Programming - Creating Algorithms - Drawing
Flowcharts - Writing Pseudocode - Evolution of C language, its
usage history - Input and output functions: Printf and scanf -
Variables and identifiers – Expressions - Single line and
multiline comments - Constants, Keywords - Values, Names,
Scope, Binding, Storage Classes - Numeric Data types: integer -
INSTITUTE OF SCIENCE AND TECHNOLOGY,
CHENNAI.
1. 1 Evolution of Programming & Languages
q A Computer needs to be given instructions in a programming
language that it understands
q Programming Language
q Artificial language that controls the behavior of computer
q Defined through the use of syntactic and semantic rules
q Used to facilitate communication about the task of organizing
and manipulating information
q Used to express algorithms precisely
INSTITUTE OF SCIENCE AND TECHNOLOGY,
CHENNAI.
1. 2 Problem Solving through Programming
q Problem - Defined as any question, something involving doubt,
uncertainty, difficulty, situation whose solution is not immediately obvious
q Computer Problem Solving
q Understand and apply logic
q Success in solving any problem is only possible after we have
made the effort to understand the problem at hand
q Extract from the problem statement a set of precisely defined
tasks
INSTITUTE OF SCIENCE AND TECHNOLOGY,
CHENNAI.
1. 2 Problem Solving through Programming Contd…
i. Creative Thinking
q Proven method for approaching a challenge or opportunity in
an imaginative way
q Process for innovation that helps explore and reframe the
problems faced, come up with new, innovative responses and solutions and then take action
q It is generative, nonjudgmental and expansive
q Thinking creatively, a lists of new ideas are generated
INSTITUTE OF SCIENCE AND TECHNOLOGY,
CHENNAI.
1. 2 Problem Solving through Programming Contd…
INSTITUTE OF SCIENCE AND TECHNOLOGY,
CHENNAI.
1. 2 Problem Solving through Programming Contd…
INSTITUTE OF SCIENCE AND TECHNOLOGY,
CHENNAI.
q Program - Set of instructions that instructs the computer to do a
task
q Programming Process
a) Defining the Problem
b) Planning the Solution
c) Coding the Program
d) Testing the Program
e) Documenting the Program
1. 2 Problem Solving through Programming Contd…
INSTITUTE OF SCIENCE AND TECHNOLOGY,
CHENNAI.
q A typical programming task can be divided into two phases:
i. Problem solving phase
q Produce an ordered sequence of steps that describe solution
of problem this sequence of steps is called an Algorithm
ii. Implementation phase
q Implement the program in some programming language
q Steps in Problem Solving
a) Produce a general algorithm (one can use pseudocode )
1. 2 Problem Solving through Programming Contd…
INSTITUTE OF SCIENCE AND TECHNOLOGY,
CHENNAI.
b) Refine the algorithm successively to get step by step detailed
algorithm that is very close to a computer language
c) Pseudocode is an artificial and informal language that helps
programmers develop algorithms
q Pseudocode is very similar to everyday English
1. 3 Creating Algorithms Contd…
q What are Algorithms for?
q A way to communicate about your problem/solution with
others
q A possible way to solve a given problem
q A "formalization" of a method, that will be proved
q A mandatory first step before implementing a solution
q Algorithm Definition - “A finite sequence of unambiguous,
executable steps or instructions, which, if followed would ultimately terminate and give the solution of the problem”
INSTITUTE OF SCIENCE AND TECHNOLOGY,
CHENNAI.
1. 3 Creating Algorithms
q Notations
q Starting point
q Step Numbers – Positions in Algorithm
qIncoming Information - Input
q Control Flow – Order of evaluating Instructions
q Statements
q Outgoing Information - Output
q Ending Point
INSTITUTE OF SCIENCE AND TECHNOLOGY,
CHENNAI.