The document provides information about object-oriented programming languages and concepts. It discusses source code, object code, operators, data types, input/output streams, preprocessor directives, loops, decision statements, and variables. Some key points include:
- Source code is written by programmers in a human-readable language, which is then compiled into machine-readable object code.
- Common operators include math, comparison, and logical operators. Data types include integral, floating-point, and enumeration types.
- Loops like for, while, and do-while are used for repetition. Decision statements include if-else and switch-case.
- Preprocessor directives start with # and are commands for the preprocessor
3. Source Code :
In computing, source code is any collection of computer
Instructions (possibly with comments) written using some human-
readable computer language, usually as text.
Object Code :
The source code is often transformed by a compiler program into low-
level machine code understood by the computer.
4. Operators :
•Math Operators.
•Comparison .
•Logical Operators.
•Math Operators :
• + addition
• - subtraction
• * multiplication
• / division
• % modulus operator
• +, -, *, and / can be used with integral and floating-point data types
6. Data Types :
Three categories of simple data
Integral: integers (numbers without a decimal)
Floating-point: decimal numbers
Enumeration type: user-defined data type
9. Cout (used to show output)
The stream insertion operator is <<
Expression evaluated and its value is printed at the current
cursor position on the screen
10. Cin (used to get input )
Using more than one variable in cin allows more than
one value to be read at a time
For example, if feet and inches are variables of type
int, a statement such as:
cin >> feet >> inches;
Inputs two integers from the keyboard
Places them in variables feet and inches respectively
11.
12. Preprocessor Directives
C++ has a small number of operations
Many functions and symbols needed to run a C++ program are
provided as collection of libraries
Every library has a name and is referred to by a header file
Preprocessor directives are commands supplied to the
preprocessor
All preprocessor commands begin with #
No semicolon at the end of these commands
13. Syntax to include a header file:
#include <iostream>
For example:
Causes the preprocessor to include the
header file iostream in the program
14. Loop (Repetition) :
1. The while loop (loop until a condition
becomes false).
2. The do...while loop (recommended when you
need to run the loop at least once).
3. The for loop (best when there's a counter
involved) .
16. Examples : (For Loop)
Int main ()
{
For(int i=0 i ; i<5 ; i++)
Cout<<“ my name iZ sunny mirza “;
System(“pause”);
}
Example :
Int main ()
{
For(int i=0 i ; i<5 ; i++)
Cout<<i;
System(“pause”);
}
17. Example:
#include<iostream>
Using namespace std;
int main()
{
int q, w , int new1[5];
for(q=0;q<5;q++)
{
cout<<"Enter a random number :";
cin>>new1[q];
}
cout<<endl;
for(w=0;w<5;w++)
{
cout<< "Your entered numbers are : ";
cout<<new1[w];
cout<<endl;
}
System(“pause”);
}
19. Examples : (While loop)
#include<iostream>
Using namespace std;
int main()
{
int a,b;
cout<<" Input the first printing value :" ;
cin>>a;
cout<<endl;
cout<<"Input the last printing value :" ;
cin>>b;
cout<<endl;
while(a<=b)
{
cout<<" The Print out value is :"<<a;
cout<<endl;
a++;
}
system(“pause”);
}
20. #include <iostream>
using namespace std;
int main ()
{
int count = 7; int number = 0, total = 0, totalOdd = 0, totalEven = 0;
while (count < 0)
{
cin >> number;
total += number;
if (number %2 == 0) totalEven += number;
Else
totalOdd += number;
}
cout << total << totalOdd << totalEven << endl;
System(“pause”);
}
21. #include<iostream>
using namespace std;
int main()
{
int a;
cout<<"Enter the Number :";
cin>>a;
int counter = 1;
while (counter <= a)
{
cout<<"Execute While "<<counter<<" time"<<endl;
counter++;
}
system(“pause”);
}
23. #include<iostream>
using namespace std;
int main()
{
int a;
cout<<"Enter the Number :";
cin>>a;
int counter = 1;
//Do while Loop Block
do
{
cout<<"Execute Do While "<<counter<<" time"<<endl;
counter++;
}while (counter <= a);
System(“pause”);
}
24. #include <iostream>
using namespace std;
int main()
{
int x;
x = 0;
do {
// "Hello, world!" is printed at least one time // even though the condition
is false
cout<<"Hello, world!n";
}
while ( x != 0 );
System(“pause”);
}
25. #include <iostream>
using namespace std;
int main()
{
int counter, howmuch;
cin >> howmuch;
counter = 0;
do {
counter++;
cout << counter << 'n';
}
while ( counter < howmuch);
System(“pause”);
}
26. Decisiom Statements :
IF Statement
if the condition in the if statement evaluates to true, then the
specified set of statement block is executed, otherwise the if
statement exits.
The syntax of the if statement is as follows: -
if(condition)
{
statement-block;
}
28. #include<iostream>
using namespace std;
int main()
{
// Variable Declaration
int a;
//Get Input Value
cout<<"Enter the Number :";
cin>>a;
//If Condition Check
if(a > 10)
{
// Block For Condition Success
cout<<a<<" Is Greater than 10";
}
// Wait For Output Screen
system(“pause”);
}
29. include<iostream>
using namespace std;
int main()
{
int Num;
cout<<"Enter Number to check it is Even ";
cin>>Num;
if(Num%2==0)
{
cout<<"Number is Even”;
}
System(“pause”);
}
30. IF Else Statement
If the condition in the if statement evaluates to true, then the
specified set of statement block is executed, otherwise the
statement-block in the else block is executed. In other words, the if-
else statements contains a set of statement-block for both the
cases, either the condition evaluates to true or false.
The syntax of the if statement is as follows: -
if(condition)
{
statement-block;
}
else
{
statement-block;
}
31. Examples :
#include<iostream>
using namespace std;
int main()
{ int Num;
cout<<"Enter Number to check it is Even or Odd: ";
cin>>Num;
if(Num%2==0)
{
cout<<"Number is Even“;
}
else
{
cout<<" Number is Odd";
}
system(“pause”);
}
32. #include<iostream>
using namespace std;
int main()
{
int a;
cout<<"Enter the Number :";
cin>>a;
if(a > 10)
{
cout<<a<<" Is Greater than 10";
}
else
{
cout<<a<<" Is Less than/Equal 10";
}
System(“pause”);
}
33. #include<iostream>
using namespace std;
int main()
{
int age, height;
cin >> age;
cin >> height;
if(age == height)
{
cout << "Your age and height are the same!";
}
Else
Cout<<“not same: “;
System(“pause”);
}
34. Nested If Else :
Used when want to add more than 1 conditions for
different outputs.
if (i == 1) { // action 1 }
else
{ if (i == 2) { // action 2 }
else
{ if (i == 3) { // action 3 }
else
{ // action 4 } } }
35. int age, height;
cin >> age;
cin >> height;
if(height == age)
{
cout << "Your height is equal to your age!"; }
else if(height < age)
{
cout << "Your height is less than your age!";
}
else if(height > age)
{
cout << "Your height is greater than your age!";
}
36. int main()
{ int mark;
cout << "What mark did you get in the test?" << endl;
cin >> mark;
if(mark >= 90)
{ cout << "You got an A*" << endl;
cout << "You Passed!" << endl; }
else if(mark >= 80)
{ cout << "You got an A" << endl;
cout << "You Passed!" << endl; }
else if(mark >= 70)
{ cout << "You got an B" << endl;
cout << "You Passed!" << endl; }
else {
cout << "You got an U" << endl;
cout << "You Failed!" << endl; }
return 0; }
37. Switch Case ( works similar to like nested if else)
switch (i)
{ case 1:
// action 1 break;
case 2:
// action 2
break; case 3:
// action 3
break; default: // action 4 break;
}
38. Control Statements:
Break :
The break statement terminates the execution of the nearest
enclosing do, for, switch, or while statement in which it appears. Control passes to
the statement that follows the terminated statement.
Syntax
jump-statement:
break;
#include<iostream>
using namespace std;
int main()
{
39. Continue :
The CONTINUE statement exits the current iteration of a loop, either
conditionally or unconditionally, and transfers control to the next iteration
of either the current loop or an enclosing labeled loop.
Restrictions on CONTINUE Statement
A CONTINUE statement must be inside a LOOP statement.
A CONTINUE statement cannot cross a subprogram or method boundary.
Return Statement
The return statement terminates the execution of a function and returns
control to the calling function.
jump-statement:
return expression opt ;
40. Variables :
A quantity whose value can be change in the program.
Holder of Constant value (Container).
Decleration
int x;
41. Design of Programming Languages
OOP Languages
Made by :Ahsan Ali
121. Orca
122. Orient84/K
123. OSCAR
124. O'small
125. Oz
126. Parasol
127. Parlog++
128. Pascal Plus
129. PECOS
130. PHOCUS
131. Pict
132. Polka
133. POLYGOTH
134. POOL2
135. POP++
136. PopTalk
137. Probe
138. Prolog++
139. PROOF/L
140. Python
141. Real-Time
Mentat
142. ROME
143. Rossette
59. ETHER
60. EXTRA
61. FLEX
62. FMPL
63. FOOP
64. Formes
65. Fresco
66. G
67. GEL
68. HERAKLIT
69. HOOK
70. Hybrid
71. IDOL
72. InnovAda
73. ISLisp
74. Jade
75.
JavaKaleidoscope
77. Kevo
78. LAMINA
79. Late-bound
80. LAURE
81. Leda
1. A#
2. ABCL
3. Abel
4. Actor
5. Acttalk
6. Ada
7. ADES
8. ADVSYS
9. Agora
10. Alcool-90
11. ALLOY
12. ALTRAN
13. AppleScript
14. ASDL
15. A’UM
16. BeBOP
17. Beta
18. BLAZE 2
19. Blue
20. Bob
21. BOPL
22. C*
23. C++
☺THANK YOU
List of some of the Object-Oriented Programming
Languages in Existence Today
Made by :Ahsan Ali