Lecture No.04
Lecture No.04
Allah
The Most Merciful and Compassionate the most
gracious and beneficent, Whose help and
guidance we always solicit at every step, at every
moment.
Programming Concepts
Variables
Assignment Operator
Data Types
Let’s consider a simple example to explain int data type. In this example we take two integers,
add them and display the answer on the screen. The code of the program is written below.
#include <iostream.h>
main( )
{
int x;
int y;
int z;
x = 5;
y = 10;
z = x + y;
cout << “x = “;
cout << x;
cout << “ y=“;
cout << y;
cout << “ z = x + y = “;
cout << z;
}
#include <iostream.h>
main()
{
short x;
short y;
short z;
x = 5;
y = 10;
z = x + y;
cout << “x = “;
cout << x;
cout << “ y=“;
cout << y;
cout << “ z = x + y = “;
cout << z;
}
#include <iostream.h>
main()
{
char x;
x = ’a’;
cout << “The character value in x = “;
cout << x;
}
Thanks
Questions?