Programming Fundamentals Lecture # 1: Introduction: BS Joddat Fatima
Programming Fundamentals Lecture # 1: Introduction: BS Joddat Fatima
FUNDAMENTALS
LECTURE # 1: INTRODUCTION
BS
Joddat Fatima
1
joddat.fatima@gmail.com
Department of SE
Bahria University Islamabad
COURSE INFORMATION
Instructor
Miss JODDAT FATIMA
Cabin: XC- Ground Floor
Email: joddat.fatima@gmail.com
Office Hours
Monday-Wednesday : 10:30 to 12:30
2
WHO ARE YOU???
3
COURSE INFORMATION
Course Ressources
Object Oriented Programming in C++ by Robert Lafore
C++ How to Programme by Dietel and Dietel
A Structured Programjing Approach Using C++ by Behrouz A.
Forouzan
4
COURSE OBJECTIVE
5
COURSE CONTENTS
Operators
Variables
Selection Structure
Repetition Structure
Functions
Arrays
Structures
Pointers
6
GRADING POLICY
7
INTRODUCTION
COMPUTER
Software
Instructions to command computer to perform actions and make
decisions
Hardware
Various devices comprising computer
language e.g.
I want to view this webpage 8
Calculate my annual tax
WHY ANOTHER LANGUAGE?
However, today’s computer’s are not intelligent enough to understand our orders
in natural language.
Ambiguity:
The tourist saw the astronomer with the telescope
The tourist used the telescope to see the astronomer.
The astronomer that the tourist saw had a telescope.
10
A WORD OF CAUTION
Therefore,
THERE IS NO SHORTCUT TO PROGRAMMING
SKILLS AND EXPERIENCE.
11
HOW TO LEARN PROGRAMMING
12
HOW TO LEARN PROGRAMMING CONT..
13
SCARE OF PROGRAMMING?
Paradigm Change
Programming is totally different paradigm. You are working on
something and you cannot even touch the final output you can only
feel it. It is different then other subjects like Physics, Chemistry,
Biology, etc.
Peer Pressure
Some people are naturally good in programming so others think that
this is a natural ability and they cannot learn it.
Lack of Understanding in Fundamental Concepts 14
SCARE OF PROGRAMMING?
16
17
18
19
PREPROCESSING DIRECTIVES
#include <iostream>
21
BASIC PROGRAM
23
COMMENTS IN C++
//comments.cpp
/*demonstrating comments*/
Document programs
Improve program readability
Ignored by compiler
24
DIVIDING CODE
The separation in different lines of code has been done just to give
greater readability to the program, since main could have been
perfectly valid defined this way:
int main () { cout << " Hello World! "; cout << " I'm a C++ program ";
return 0;
We were also free to divide the code into more lines if we considered it
more convenient:
int main ()
{
cout <<"Hello World!";
cout<< "I'm a C++ program";
return 0; 25
}
PROBLEM SOLVING TECHNIQUES
26
CALCULATE AND PRINT THE AVERAGE GRADE
OF 3 TESTS FOR THE ENTIRE CLASS
Input
3 test scores for each student
Output
Average of 3 tests for each student
Process
1. Get three scores
2. Add them together
3. Divide by three to get the average
4. Print the average
5. Repeat step 1 to 4 for next student
6. Stop if there are no more students
27
ALGORITHM ATM FOR WITHDRAWAL
Output
Money, error messages
Inputs
User Identification (ATM card), password, amount
Process
1. Get the ATM card for identification and ask for password
2. Check password
3. If password is not valid, generate an error message and go to step number 8.
4. Get the amount from the user
5. Check the current balance
6. If amount is greater than current balance, generate an error message and go to
step number 8.
7. Subtract the amount from the balance and give out the cash.
8. Return the ATM card
9. Stop
28
29