You are on page 1of 16

Programming with C and C++

in Internshala
Name- Syed Mohd Areeb
Registration no- 11702322
INTRODUCTION
OF
C
C is a general-purpose high level language that was originally developed by Dennis
Ritchie for the Unix operating system. It was first implemented on the Digital
Eqquipment Corporation PDP-11 computer in 1972.
The Unix operating system and virtually all Unix applications are written in the C
language. C has now become a widely used professional language for various reasons.
Easy to learn
Structured language
It produces efficient programs.
It can handle low-level activities.
It can be compiled on a variety of computers.

Simple C Program
# include <stdio.h>
int main(void) {
printf(“Hello World\n”);
return 0;
INTRODUCTION
OF
C++

C++, as we all know is an extension to C language and was developed by Bjarne


stroustrup at bell labs. C++ is an intermediate level language, as it comprises a
confirmation of both high level and low level language features. C++ is a
statically typed, free form, multiparadigm, compiled general-purpose language.
C++ is an Object Oriented Programming language but is not purely Object
Oriented. Its features like Friend and Virtual, violate some of the very important
OOPS features, rendering this language unworthy of being called completely
Object Oriented. Its a middle level language.

Simple C++ Program


#include <iostream.h>
int main(void) {
cout << “Hello World\n”;
return 0;
}
USES OF C

1) C programming language can be used to design the system software like


operating system and Compiler.
2)To develop application software like database and spreadsheets.

3) Develop Graphical related application like a computer and mobile games.

4) To evaluate any kind of mathematical equation use c language.

5) C programming language can be used to design the compilers.

6) UNIX Kernal is completely developed in C Language.


USES OF C++

1) C++ is used by programmers to develop computer software.

2) It is used to create general system software.

3) Used to build drivers for various computer devices.

4) Software for servers and software for specific applications.

5) Used in the creation of video games.


OBJECTS
Objects are basic runtime entity in object oriented system. When a program is executed,
the objects interact by sending messages to one another.
CLASS
Classes are user defined data types and it behaves like built in types of programming
language. It is the way to bind the data and function to gather in a single unit.

class Abc
{
int x;
void display()
{
// some statement
}
};
int main()
{
Abc obj;
// Object of class Abc created
}
.
INHERITANCE

The mechanism of deriving a new class from an old class is called inheritance
or derivation. The old class is known as base class while new class is known as
derived class or sub class. The inheritance is the most powerful features of
OOP
TYPES OF INHERITENCE

1) Public Inheritance
This is the most used inheritance mode. In this the protected member of super
class becomes protected members of sub class and public becomes public.
class Subclass : public Superclass

2) Private Inheritance
In private mode, the protected and public members of super class become private
members of derived class.
class Subclass : Superclass // By default its private inheritance

3) Protected Inheritance
In protected mode, the public and protected members of Super class becomes
protected members of Sub class.
class subclass : protected Superclass
POLYMORPHISM
Polymorphism is a Greek term which means ability to take more than one form. For example, + is
used to make sum of two numbers as well as it is used to combine two strings.
Or
It is done by the method Function overriding.

class Base
{
public: void show()
{
cout << "Base class";
}
};
class Derived:public Base
{
public: void show()
{
cout << "Derived Class";
}
}
PROJECT ON C
QUIZ GAME

You might also like