Lec-1-Introduction To The Course
Lec-1-Introduction To The Course
Lec-1-Introduction To The Course
PROGRAMMING FUNDAMENTALS
LECTURE 1
Computer
• A machine which can perform
calculations and make logical decisions
billions of time faster as compared to
human .
• Todays’s fastest computer can perform
thousands of trillions instruction PER
SECOND !
Session 1 2
Applications of Programming
Robotics:
Applications of Programming
Simulation:
Applications of Programming
Scripting:
Programming Languages
Pick up the red pen and
place it on the table
Session 1 5
Machine Language: Our First
Interaction with the Computer
• machine language.
10110011 00011001
01111010 11010001 10010100
10011111 00011001
01011100 11010001 10010000
10111011 11010001 10010110
– Finding an average of two numbers
• Not very intuitive way of working
• Not possible for humans to achieve a lot using machine
language
Session 1 6
One Step Beyond - Assembly Language
•One level above machine language is assembly
language
MOV 0, SUM
MOV NUM, AC
ADD SUM, AC
STO SUM, TOT
Session 1 7
Another Step - High-level
Languages
•High-level languages is another level above
machine language.
X = (Y + Z) / 2
• Much more understandable.
• A compiler translates high-level language
Session 1 8
What is Programming?
• When we say “programming” we are
actually referring to the science of
transforming our intentions in a high-level
programming language.
Session 1 10
Back-end Programming Languages
Top Programming Languages
Top Languages wrt Jobs
Programming Languages
• Programming Language
– A set of rules, symbols, and special words used to
construct a computer program.
• Machine Language
– The binary representation of the instructions that a computer's hardware can
perform.
• Assembly Language
– A low-level programming language in which a mnemonic is used to represent
each of the machine language instructions for a specific computer.
• High-Level Language
– A computer language that is more understandable and closer to standard
notations than assembly language. It is more close to plain English. C/C++ are
high-level languages.
Programming language rules
• Rules of Syntax which specify how valid instructions are written in
the language.
– They deal with the structure of an instruction
Primary
Memory
CPU
CPU takes each
instruction and
executes it, possibly
storing new data
..
.. values as the program
..
executes.
• Functions • Directives
– Function name – Preprocessor
– Braces and the Directives #
function body – Header Files
– Main function – The ‘using’ Directive
• Program Statements – comments
• Output using cout
A basic program
// ------------------------------------------------------------
/ *hello.cpp is a demonstration program
Welcome to C++*/ Comments
Preprocessor Directives/
Header File
#include <iostream>
using namespace std;
The using Directive
void main ( )
{
cout << "Hello C++ World ! \n";
}
A basic program
// ------------------------------------------------------------
/ *hello.cpp is a demonstration program
Welcome to C++*/
#include <iostream>
using namespace std; The main() function
void main ( )
{ Escape Sequence
cout << "Hello C++ World ! \n";
End of a statement
}
String Constant
Insertion Operator
33