ICT_Basic Computer Programming_PART 1 (1) (1)
Computer Programming Overview
Instructor: Suzette N. Floresca
Instructional Resources/Textbook References
Bronson, Gary J.: C++ Programming: Principles and Practices (Cengage, 2013)
Forouzan, Behrouz A.: Foundations of C Programming (Cengage, 2011)
Malik, D.S.: C++ Programming: Problem Analysis to Program Design (Cengage, 2011)
Scholl, T. & Nugent, G.: C++ Programming Problem Analysis to Program Design (Lab Manual, Cengage, 2011)
Vine, Micheal A.: C Programming for the Absolute Beginner (2008)
Internet Sources
www.course.com
www.thomsonlearning.com
www.tutorialspoint.com/cprogramming/
www.cprogramming.com/tutorial/c-tutorial.html
www.iu.hio.no/~mark/CTutorial/CTutorial.html
http://fresh2refresh.com/c-tutorial-for-beginners
Key Concepts
What is Computer Programming?
Definition: Sequence of instructions for a computer to perform tasks.
Core Idea: Primarily problem-solving.
Programming Language
Definition: An artificial language to control computer behavior.
Programming Language Translation
Source Program: High-level programming code.
Object Program: Source translated to machine language.
Translator Program: Converts source to object; can be a compiler or interpreter.
Compilers vs. Interpreters
Compiler: Translates entire program at once, faster execution but requires a compilation step.
Interpreter: Translates line-by-line but runs slower, no separate compilation step.
Process of Creating a Computer Program
Steps
Logic Development: Define the problem and logic to solve.
Coding: Translate logic into programming language syntax.
Testing: Identify and fix errors in the program.
Documentation: Keep records of program structure and logic.
Common Programming Errors
Syntax Errors: Violations of grammar rules caught at compile time.
Run-time Errors: Errors during execution that stop the program (e.g., division by zero).
Logic Errors: Faulty algorithm leading to incorrect results, harder to identify.
Overview of C Programming Language
History: Developed by Dennis Ritchie at AT&T Bell Labs in 1972.
Popularity: One of the most widely used languages; portable and versatile.
Key Features:
Concise with only about 32 keywords.
Modular, powerful, and well-suited for various programming tasks.
Serves as a foundation for languages like C++.
C Language Elements
Preprocessor: Processes commands before compilation (e.g., #include).
Directives: Instructions within source code (e.g., #define).
Variable Naming Conventions
Must start with a letter or underscore.
Cannot start with a digit or contain spaces.
C is case-sensitive.
Data Types in C
Basic Types: char, int, float, double.
Modifiers: short, long, signed, unsigned.
Input/Output Functions
scanf(): For numeric input.
printf(): For formatted output to the standard output device.
Control Flow in Programming
Types of Control Structures:
Sequential: Steps follow one after another.
Conditional: Includes decision-making.
Iterative: Repeats steps until a condition is met.
Flowcharting Techniques
Flowcharts visualize the sequence of operations in problem-solving.
Symbols: Terminal, input, output, processing, decision symbols.
Sample Problems and Applications
Create flowcharts for various scenarios (calculating areas, managing sales, etc.).
Emphasizing the application of programming concepts in real-world tasks.