2nd Lecture

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Object Oriented Programming

Third Semester (2nd Stage)


C++ PROGRAMMING LANGUAGE
Lecture: Areen J.fadhil

C++ Programming Language:


In simple terms, C++ is a sophisticated, efficient and a general-purpose programming language
based on C. It was developed by Bjarne Stroustrup in 1979.

Many of today’s operating systems, system drivers, browsers and games use C++ as their core
language. This makes C++ one of the most popular languages today.

// C++ code to read the output “Hello World” :

#include <iostream>
Using namespace std;
void main () {
cout << "Hello World!";
return 0;
}
// C++ code program by using to integer number then find the average:
#include <iostream>
using namespace std;
void main () {
int num1 = 70;
int num2 = 256;
int average;
cout << num1 << endl;
cout << num2 << endl;
average = num1 + num2;

cout << "average=” <<average;


return 0;
}

// C++ Program to find the area:


#include <iostream>
using namespace std;

int main()
{
int length;
int width;

length = 7;
width = 5;

cout << "The area is ";


cout << length * width;

return 0;
}
// C++ Program to find Plus, minas
#include <iostream>

using namespace std;

int main()

int num1, num2, a, b;

num1 = 1;

num2 = 2;

a = num1 + num2;

b = num1 - num2;

cout << num1 << " + " << num2 << " is " << a << endl;

cout << num1 << " - " << num2 << " is " << b << endl;

return 0;

// C++ code Program inter the number by user :


#include <iostream>
using namespace std;
void main() {
int num;
cout << "Enter an integer: ";
cin >> num;
cout << "The number is: " << num;
return 0;
}
//C++ code program enter the numbers by user

#include <iostream>
using namespace std;
void main () {
int num;
cin >> num;
cout << "Number: " << num;
return 0;
}

You might also like