0% found this document useful (0 votes)
44 views

Chapter 1 Problem Solving and Introduction To C

This document introduces concepts related to problem solving and programming. It discusses problem solving techniques and tools like flowcharts and algorithms. It provides an overview of procedural and object-oriented programming approaches. It also introduces C programming concepts like basic structure, compilers used, and sample programs.

Uploaded by

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

Chapter 1 Problem Solving and Introduction To C

This document introduces concepts related to problem solving and programming. It discusses problem solving techniques and tools like flowcharts and algorithms. It provides an overview of procedural and object-oriented programming approaches. It also introduces C programming concepts like basic structure, compilers used, and sample programs.

Uploaded by

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

INTRODUCTION TO PROBLEM

SOLVING AND PROGRAMMING


CONCEPTS
BY: SAMWEL TARUS
INTRODUCTION TO PROGRAMMING CONCEPTS
Problem solving
Techniques of problem solving
Tools of problem solving.
Programming methodologies
Introduction to C programming language
Basic structure of a structured programming language (C language)
Importance of a structured programming language
Executing a structured language.
Sample programs to demonstrate the concepts
Basic Terms in Programming
Instruction

Program

Software

System, Computer

Source Program

Object Program

Computer Languages H.L.L, Assembly machine lang (0,1)

programmer
Problem solving

• The act of defining a problem; determining the cause of the problem;


identifying, prioritizing, and selecting alternatives for a solution; and
implementing a solution.

• Basic steps in solving a problem:


Defining the problem.
Generating alternatives.
Evaluating and selecting alternatives.
Implementing solutions.
Techniques of problem solving

1. Divide and conquer strategy

2. Trial and error strategy

3. Top down strategy

4. Bottom up strategy
Factors to consider when selecting a technique for solving a
problem.
Nature of the problem
Familiarity with the technique
Cost of the technique
Reliability of the technique
Efficiency of the technique
Robustness of the technique
Accuracy of the Technique
Flexibility of the Technique
Tools of problem solving.

1. Flowcharts

2. Algorithm

3. Program
Flowcharts
Diagrammatic / Pictorial representation of the solution process to a problem.
Uses shapes and symbols of different types to represent the set of activities in
problem solving.
A graphical representations of steps.
• E.g, Oval Rectangle Arrows

• Decision
Benefits of a flowchart
1. Easier to understand compare to Algorithms and Pseudo code.
2. Helps to clarify complex processes.
3. Communication:
Better way of communicating the logic of a system to all concerned or involved.
Helps team members gain a shared understanding of the process and use this knowledge
to collect data, identify problems, focus discussions, and identify resources.
4. Effective analysis:
Problem can be analyzed in more effective way tea4 reducing cost and wastage of time.
5. Proper documentation:
Serve as a good program documentation, which is needed for various purposes, making
things more efficient.
6. Efficient Program Maintenance:
Helps the programmer to locate errors and put more efforts more efficiently.
7. Efficient Coding:
Guidelines for Developing Flowcharts

These are some points to keep in mind while developing a flowchart −

Flowchart can have only one start and one stop symbol

General flow of processes is top to bottom or left to right

Arrows should not cross each other

On-page connectors are referenced using numbers

Off-page connectors are referenced using alphabets


Algorithms
• Finite sequence of well-defined, computer-implementable instructions,
typically to solve a class of problems or to perform a computation
• Series of instructions that are followed, step by step, to do something
useful or solve a problem.
You could consider a cake recipe an algorithm for making a cake, for
example.
• Characteristics of algorithms:
Sequence of statements must not be ambiguous.
Sequence of statements must have a start and an end
All algorithms must terminate producing a solution.

• Examples:
Programming methodologies

1. Procedural (Modular) programming approach

2. Object Oriented programming approach


Procedural (Modular) programming approach
One that directly instructs a device on how to finish a task in logical steps.
Linear top-down approach and treats data and procedures as two different entities.
Divides the program into procedures, which are also known as routines or
functions, simply containing a series of steps to be carried out.
Object Oriented Programming
• Views a problem as a collection of objects.

• https://hackr.io/blog/procedural-programming
Introduction to C programming language

H.L.L introduced by Brian Kernighan and Dennies Ritchie in 1972.


English notation
A modular programming language. BCPL 1964
Programming language developed at AT & T’s Bell Laboratories of USA in
1972.
Used to write system software. (UNIX o/s).
Basic structure of a structured programming language (C language)
Documentation Section Directed user
Header Files Section
main( ) Function Section
{
Declaration part
Executable part
}
Sub program section
{ Declaration part /* user defined function*/
Executable part
}
Importance of a structured programming language
It is user friendly and easy to understand.

Similar to English vocabulary of words and symbols.

It is easier to learn.

They require less time to write.

They are easier to maintain.

These are mainly problem oriented rather than machine based.

Machine independent.
Compilers used in C programming
Borland C ...

Dev C

Turbo C

Code block.

Embarcadero C++ builder. ...

Clang

C Free

Intel C++ ...


Executing a structured language.

1. To demonstrate using a program

2. Creating a new program.

3. Saving a program

4. Running the program

5. Closing the program


Sample programs to demonstrate the concepts

1. Program to display welcome to C programming

2. Program to find sum of any two input numbers.

3. Program to compute simple interest for the sum invested.

You might also like