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

1 Introduction

BS IT #1

Uploaded by

wahabkhalid245
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

1 Introduction

BS IT #1

Uploaded by

wahabkhalid245
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Programming Fundamentals

Muhammad Ali
Course Outline Week-Wise
Week Topic
Introduction:
1 Introduction to the course and main topics.
Course Objectives
Overview of Computers and Programming:
2 Computers and data processing, Overview of the computer system and
programming

Data Types, Variables and Operators:


Review of C features, Variables, constants, I/O (printf and scanf ), Data types
3 overview, Take Care With printf and scanf!, Operators in C, Arithmetic
Operators, Using Arithmetic Operators

Other Operators:
4 Relational Operators, Logical Operators, Assignment, Conditional Expression
Operator, Precedence of Operators

5
Week Topic

14
Control Flow:
Nesting if, switch, More about switch and multiple selection

15
Loops Concept:
Looping, for loop, for loop examples, Stepping with for,

Loops:
16 while loop, Semicolon Warning! , while vs do while and for loop, Extending
the for loop, break, continue

17 Final EXAM
Reference Books:
“C++ : How to Program”, by Deitel & , Deitel 7 th Edition
2010.

“C++ Programming: From Problem Analysis to Program


Design”, by D. S. Malik, Second Edition.

“Problem Solving and Program Design in C”,


by Jeri Hanly & E. B. Koffman, 4 th Edition,

Assignments : Each student is required to complete a


number of written assignments to understand some
concepts and the course contents.
Programming Innovations
Major innovations in programming
Object- oriented programming (OOP)
 Powerful way to copy with complexity

The Unified Modeling Language (UML)


 Graphical Language,
 Easier and more effective
History of C++
 Bjarne Stroustrup, a Danish computer scientist, began his work on C++'s
predecessor "C with Classes" in 1979.

 In 1983, it was renamed from C with Classes to C . New features were added
 virtual functions
 function name operator overloading,
 references, constants, type-safe free-store memory allocation (new/delete),
improved type checking, and BCPL style single-line comments with two forward
slashes (//), as well as the development of a proper compiler for C++, Cfront.

 In 1985, the first edition of The C++ Programming Language was released,
which became the definitive reference for the language, as there was not yet
an official standard.[8]The first commercial implementation of C++ was
released in October of the same year. [5]
 In 1989 C++ 2.0 was released followed by the updated second edition of The
C++ Programming Language in 1991.

 New features in 2.0 included multiple inheritance, abstract classes, static


member functions, const member functions, and protected members. In
1990, The Annotated C++ Reference Manual was published.

 This work became the basis for the future standard. Late feature additions
included templates, exceptions, namespaces, new casts, and a boolean type.

 In 2011, C++11 was released which added more features and enlarged the
standard library further (compared to it in 1998), providing more facilities
for C++ programmers to use, with more additions
planned for 2014 and 2017 .
Structure of C++ Programs
Consists of Three main parts

Preprocessor Directives

The main() Function

C++ Statement
Preprocessor Directives
The instruction that are given to the complier before
the beginning of the actual program
Example:

#include <iostream.h>
main()
{
cout<<“Hello World”;
}
Header File
Header file is a c++ source file that contains definitions
of library function/objects.
Syntax

#include <name of the header file>


The main() Function
Indicates the beginning of a C++ program.
Syntax

Main()
{
Program statements……
}
Variables
First character of variable name must be an alphabetic
character,
Underscore can be used as first character of variable name,
Blank spaces are not allowed in variable name.
Special characters, such as arithmetic operations, #,^,
cannot be used in a variable name.
Reserved words cannot be used as variable names.
Maximum length of a variable name depends upon the
compiler of c++.
Variable name declared for one data-type cannot be used to
declare another date-type.
Example
Variable Name Valid/Invalid Remarks
Nadeem valid
Perform Valid
Double invalid C++ reserved word
Foxpro Valid
Switch Invalid C++ reserved word
Marriam Valid
int invalid C++ reserved word
Unsigned invalid C++ reserved word
X-y invalid C++ reserved word
Date types
Type Size
Int 16 bits
Short int 16 bits
Long int 32 bits
Unsigned int 16 bits
Unsigned long int 32 bits
Float 32 bits
Long float 64 bits
double 64 bits
Long double 80 bits
Char 8 bits
Declaration of Variable
Assigning the name and data type that a variable can
hold is called declaration of the variable.

Int a, xy;
Float b;
Char nm [15];
Double sum;
Initialization of Variables
Int a = 110, b = 60, c;
Example
#include <iostream.h>
Main()
{
Output:
Int abc = 4, b = 1997;
Float xy = 3.4; ALI
4
Char name [15] = “ALI”; 1997
Cout<<name<<endl; 3.4

Cout<<abc<<endl;
Cout<<b<<endl;
Cout<<xy<<endl;
}

You might also like