Introduction to Computers & Programming Languages

Prateek Narang

Topics

  • Computer Applications

  • Programming Languages

  • Source Code

  • Compiler

  • Machine Code

  • Program Execution

Computers Applications - Mobile, Desktop, Web!

  • Cab Booking
  • Shopping
  • Food Ordering
  • Instagram 
  • News
  • Weather Forecasts

Apps are everywhere!

Input Data

Output Data

What does a computer application do?

Location (lat,long)

Weather Forecast

Weather Forecast App

Image Editing App

(40,70,30)

Sum = 140

Simple Calculator

Its  the Programmer, who writes all this code 

A computer program is a set of instructions, written in a programming language.

 

Computer Program/Application

We need language to communicate our ideas!

English, Hindi,

German, French

etc.

We need Language to communicate our ideas!

C++, Java, Python, JavaScript etc

We need Language to communicate with a computer too!

Programming languages are set of rules that consist of instructions for computers. There are many programming languages like C++, Java, Python, JavaScript, Go, Kotlin, DART etc. 

 

Programming Language

Sample C++ Code

#include<iostream>
using namespace std;


int main(){
	// Your Code Goes Here
	cout <<"Hello World!";
	
    return 0;
}

Sample Java Code

class Main {
	public static void main(String args[]) {
		// Your code goes here
        
        
	}
}
class Main {
	public static void main(String args[]) {
		// Your code goes here
        System.out.println("Hello");
	}
}

Source Code

Computers don't understand Programming Language directly!

#include<iostream>
using namespace std;


int main(){
	// Your Code Goes Here
	cout <<"Hello World!";
	
    return 0;
}

Source Code

A computer program in its human-readable form is called source code

Source code needs another computer program to execute because computers can only execute their native machine instructions. Therefore, source code may be translated to machine instructions using the language's compiler

#include<iostream>
using namespace std;


int main(){
	// Your Code Goes Here
	cout <<"Hello World!";
	
    return 0;
}

Source Code

Compiler

Machine Code

Machine language is a set of instructions executed directly by a computer’s central processing unit (CPU). Each instruction performs a very specific task, such as a load, a jump, or an ALU operation on a unit of data in a CPU register or memory. Every program directly executed by a CPU is made up of a series of such instructions.

#include<iostream>
using namespace std;


int main(){
	// Your Code Goes Here
	cout <<"Hello World!";
	
    return 0;
}

Source Code

Compiler

Machine Code

Once the instructions are fed, the computer program is ready to accept input data and generate desired output.

Output

Input 

Logic

Program Execution
When a program starts executing, then the operating system loads it into memory and starts a process. The CPU starts executing the instructions written in the program and any required data is also loaded into memory (RAM).

 CPU + Memory 

Program Execution
When a program starts executing, then the operating system loads it into memory and starts a process. The CPU starts executing the instructions written in the program and any required data is also loaded into memory (RAM).

[Topics 01] Intro to Programming

By Prateek Narang

[Topics 01] Intro to Programming

  • 16