CPP Project

You might also like

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

A PROJECT REPORT

ON

“VOTING MANAGEMENT
SYSTEM”
SUMITTED IN PARTIAL FULFILLMENT
FOR THE DEGREE
HDCA
BY
J.SURENDER
UNDER THE GUIDANCE OF
Miss.Vigneswari A,B.TECH.,

1
BONAFIDE CERTIFICATE

This is to certify that the project work that


is begin submitted by J.surender ”Student
report card” is record of bonafide work done
under my supervision. The contents of this
project work, in full or in parts, have neither
been taken from any other source nor have
been submitted for any other course.

Signature Signature

Mr.V.J.GNANESWARAN.,B.E., Miss.A.VIGNESWARI.,B.TECH.,

CENTER DIRECTOR PROJECT GUIDE

2
ACKNOWLEDGEMENT

To matter what accomplishment, we


achieve somebody helps us. For every
accomplishment we need the
cooperation and help of others. As
knowledge advantages by steps not by
leaps so, ability advances by
encouragement and guidance. Although
you have ability and knowledge but is
worthless unless and until you can
develop it if somebody encourages you.
I express my deep senseof gratitude and
feeling of indebtedness to
Miss.Vigneswari project guide, for their
bold attention in this particular time of
project and guideus as per according to
progress of our project

3
Table of Contents

Introduction ................................................................................ 5
Why learn c++?........................................................................ 10
C++ advantage and dis advantage ................................... 18
Features of c++ ........................................................................ 22
What is c++ used for? ........................................................... 27
History of c++........................................................................... 33
Why c++ is so popular? ........................................................ 65
Abstract ...................................................................................... 71
VOTING MANAGEMENT SYSTEM .................................... 73
Advantages and Disadvantages ....................................... 73
Screenshots ............................................................................... 85
Explanation ............................................................................... 89
Conclusion ................................................................................. 93
Reference ................................................................................... 94

4
Introduction
C++ is a general-purpose programming language that was
developed as an enhancement of the C language to include
object-oriented paradigm. It is an imperative and a
compiled language.

C++ is a high-level, general-purpose programming


language designed for system and application
programming.
It was developed by Bjarne Stroustrup at Bell Labs in 1983
as an extension of the C programming language.
C++ is an object-oriented, multi-paradigm language that
supports procedural, functional, and generic programming
styles.
One of the key features of C++ is its ability to support low-
level, system-level programming, making it suitable for
developing operating systems, device drivers, and other
system software.
At the same time, C++ also provides a rich set of libraries
and features for high-level application programming,
making it a popular choice for developing desktop
applications, video games, and other complex applications.
C++ has a large, active community of developers and users,
and a wealth of resources and tools available for learning
and using the language. Some of the key features of C++
include:
5
Object-Oriented Programming: C++ supports object-
oriented programming, allowing developers to create
classes and objects and to define methods and properties
for these objects.
Templates: C++ templates allow developers to write
generic code that can work with any data type, making it
easier to write reusable and flexible code.
Standard Template Library (STL): The STL provides a wide
range of containers and algorithms for working with data,
making it easier to write efficient and effective code.
Exception Handling: C++ provides robust exception
handling capabilities, making it easier to write code that
can handle errors and unexpected situations.
Overall, C++ is a powerful and versatile programming
language that is widely used for a range of applications
and is well-suited for both low-level system programming
and high-level application development.
C++ is a middle-level language rendering it the advantage
of programming low-level (drivers, kernels) and even
higher-level applications (games, GUI, desktop apps etc.).
The basic syntax and code structure of both C and C++ are
the same.
Some of the features & key-points to note about the
programming language are as follows:
Simple: It is a simple language in the sense that programs
can be broken down into logical units and parts, has a rich
library support and a variety of data-types.

6
Machine Independent but Platform Dependent: A C++
executable is not platform-independent (compiled
programs on Linux won’t run on Windows), however they
are machine independent.
Mid-level language: It is a mid-level language as we can do
both systems-programming (drivers, kernels, networking
etc.) and build large-scale user applications (Media
Players, Photoshop, Game Engines etc.)
Rich library support: Has a rich library support (Both
standard ~ built-in data structures, algorithms etc.) as
well 3rd party libraries (e.g. Boost libraries) for fast and
rapid development.
Speed of execution: C++ programs excel in execution
speed. Since, it is a compiled language, and also hugely
procedural. Newer languages have extra in-built default
features such as garbage-collection, dynamic typing etc.
which slow the execution of the program overall. Since
there is no additional processing overhead like this in C++,
it is blazing fast.
Pointer and direct Memory-Access: C++ provides pointer
support which aids users to directly manipulate storage
address. This helps in doing low-level programming
(where one might need to have explicit control on the
storage of variables).
Object-Oriented: One of the strongest points of the
language which sets it apart from C. Object-Oriented
support helps C++ to make maintainable and extensible
programs. i.e. Large-scale applications can be built.
7
Procedural code becomes difficult to maintain as code-size
grows.
Compiled Language: C++ is a compiled language,
contributing to its speed.
Applications of C++:
C++ finds varied usage in applications such as:
Operating Systems & Systems Programming. e.g. Linux-
based OS (Ubuntu etc.)
Browsers (Chrome & Firefox)
Graphics & Game engines (Photoshop, Blender, Unreal-
Engine)
Database Engines (MySQL, MongoDB, Redis etc.)
Cloud/Distributed Systems
Here are some key points to keep in mind while working
with C++:
Object-Oriented Programming: C++ is an object-oriented
programming language, which means that it allows you to
define classes and objects to model real-world entities and
their behavior.
Strong Type System: C++ has a strong type system, which
means that variables have a specific type and that type
must be respected in all operations performed on that
variable.
Low-level Access: C++ provides low-level access to system
resources, which makes it a suitable choice for system
programming and writing efficient code.
8
Standard Template Library (STL): The STL provides a large
set of pre-written algorithms and data structures that can
be used to simplify your code and make it more efficient.
Cross-platform Compatibility: C++ can be compiled and
run on multiple platforms, including Windows, MacOS, and
Linux, making it a versatile language for developing cross-
platform applications.
Performance: C++ is a compiled language, which means
that code is transformed into machine code before it is
executed.
This can result in faster execution times and improved
performance compared to interpreted languages like
Python.
Memory Management: C++ requires manual memory
management, which can lead to errors if not done
correctly.
However, this also provides more control over the
program’s memory usage and can result in more efficient
memory usage.
Syntax: C++ has a complex syntax that can be difficult to
learn, especially for beginners. However, with practice and
experience, it becomes easier to understand and work
with.
These are some of the key points to keep in mind when
working with C++.
By understanding these concepts, you can make informed
decisions and write effective code in this language.
9
Why learn c++?

Table of Contents
1.Career Opportunities
2.C++ is an Efficient and Fast Language
3.Suitable for Big Projects
4.Community Support of C++
5.C++ Is Everywhere
6.Embedded systems
7.Versatility
8.C++ language for simulation
9.High salary package

C++ is a general-purpose programming language.


This language is around 40 years old and has been a part
of many software problems and projects.
C++ language is preferred to make high-performance
software and is among the top programming languages.
In this tutorial, you will learn about the C++ language and
understand the top 10 reasons to learn C++ in 2023.

10
1.Career Opportunities
C++ is considered as a foundation language for many
languages. It is one of the essential languages that you
must know if you are interested in computer science.
There is a very high chance that every other programmer
or software developer who is doing great in his life is
familiar with the concepts and fundamentals of C++.
There are many different kinds of jobs out there that
require C++ language.
It is a versatile language, so it remains in high demand
amongst professionals, such as software developers, game
developers, C++ analysts and backend developers, etc.

As per the TIOBE index of 2022, C++ lies at 4th position in


the world’s most popular language.
The career or job opportunities for C++ programmers are
enormous because C++ is an old language, and a lot of
code is already written in this language.

2.C++ is an Efficient and Fast Language


C++ is an advanced language that supports various
programming methods like functional, procedural, and
object-oriented programming.
It is a fast language; its compile-time and execution time is
faster than other programming languages. Some
programming languages are also faster than C++.
11
Still, like C++, they are not close to the machine code, as it
is an intermediary language, so big organizations rely on
C++ for fast speed with lesser resources.

3.Suitable for Big Projects


C++ programming language is very well suited for big
projects. Many projects, including compilers, cloud storage
systems, databases, game development, graphic designs,
etc., are built using C++.
C++ is also used for making 3D visuals projects, these
projects require control over huge amounts of data
efficiently, and C++ is one of the best choices for that.

Also, many applications and software that you use or go


through in your daily lives are developed in C++.
For example, Spotify, the popular music streaming
application, has its backend code is written in C++.
You all know Youtube, C++ is used in building YouTube
video processing function.
The Amazon application was also written in C++, however,
there are changes over the years and more software like
these are developed using C++.

4.Community Support of C++

12
C++ is an old language and is being studied and learned by
most of the programmers around the globe, so it has huge
community support.
The large community of C++ means it will be easier and
more flexible to learn this language. Community plays a
very important role for a learner.
If someone needs any help or guidance regarding C++,
many programmers and experts are out there on different
platforms creating resources for C++.

Some of the resources are blogs, for example, C++ Tips of


the week https://abseil.io/tips/, Podcasts like CppCast
CppCast, and organizations like The C++ Alliance, and
many more are out there that can guide you through your
problem.
These resources can help a learner or programmer
understand this language and clear the doubts regarding
it.

5.C++ Is Everywhere
C++ programming language is almost everywhere around
the world. For example, it is used for making browsers,
applications, and software.
Also, C++ is used majorly to make operating systems, and
almost all operating systems are built using C++, for
example, Mac Os, Windows, Linux, etc.

13
Browsers like Safari, Opera, Chrome, Firefox, etc., are
written in C++ because it is a fast and efficient language
that is why it is preferable.
C++ is also preferred for game development and complex
business applications.
So it is being widely used in different fields requiring high
performance, and learning a language like this opens up
the doors for your career to different sectors of
organizations.

C++ is an intermediate-level language; learning this


language will give you a much deeper understanding of
programming structure.
In C++, you have to write, declare, and explain everything
in the source code, giving you a deeper knowledge of all
the program parts.

Also, the syntax of C, C++, and Java are almost the same, so
learning Java and C after C++ will be very easy.

Other languages like Python are much easier to


understand because they are almost syntax-free.
You don't have to specify everything while writing its
code, which makes the programming part easy, but you

14
don't get the opportunity to learn the logic structure of the
program like C++.
Once you have learned the C++ language, then other
languages will be easy for you to learn, as your foundation
becomes strong.

6.Embedded Systems
An embedded system is a microprocessor-based software
and hardware system that is used to design a specific
function.
Developing these embedded systems requires fast and
efficient languages like C++.
C++ is widely used in embedded systems because it is an
intermediary language.
It has both the features of the high-level and low-level
language, which gives C++ an edge over other languages
because it can directly access the hardware part without
sacrificing the high-level part.

Many embedded systems and gadgets like smartwatches,


GPS systems, mp3 players, etc., are created using C++.

As you understood the Embedded systems, move to yet


another reason.

15
7.Versatility
C++ is around 40 years old language and is still one of the
most popular languages; why is it so? C++ is versatile in
nature and is a highly adaptable language. Due to high
adaptability, it is still useful when it comes to software and
developing games.
It is widely used for so long that it is compatible with
many languages and is in demand in many sectors.
Also, top-tier companies seek employees with a good
understanding of C++ programming.

8.C++ Language for Simulations


Apart from Python, C++ is also used for simulations. Many
simulations are created with the help of the C++ library,
which is considered an alternative to the Python language.
The object-oriented approach provides faster execution,
full accessibility to the base language, portable models and
executables, and complementary development tools.
The simulation built with tools has the benefits of an
object-oriented design, including encapsulation,
polymorphism, inheritance, and parameterized typing.

9.High Salary Packages


C++ is in demand in reputed organisations like Facebook,
Google, etc.; these organisations also pay some handsome

16
salaries to the C++ developers for working on their
products.
Usually, different organizations pay differently to the
entry-level C++ developers and the experienced ones, but
the average salary of a C++ developer in India is 7,78,290
INR, and the average salary of a C++ developer in the USA
is $118,305.

The salary of an entry-level C++ developer is average in


the early years because mastering C++ usually takes some
time.
After 3 to 4 years of experience, the salary package grows
at a fast pace, which is a good reason to learn C++
language.

17
C++ advantage and dis advantage

C++ is a general-purpose programming language and


widely used nowadays for competitive programming. It
has imperative, object-oriented, and generic programming
features.
C++ runs on lots of platforms like Windows, Linux, Unix,
Mac, etc.
But there are the benefits and drawbacks of C++ on the
idea of which they will start their new journey of
programming.
It is one of the oldest and most effective languages that
also continues to dominate the realm of programming.

Advantages of C++:
C++ is an object-oriented programming language. It may
be a collection of commands, which tell the pc to try to do
“something.”
This collection of commands is typically called C++ ASCII
text files.
C++ could also be a problem-oriented language that’s
much easier to use than the other low-level languages like
binary coding.
It takes much more space than low-level languages but it’s
much easier to understand and learn.

18
C++ program has many advantages when it involves
programming, All C++ program stand-alone files must use
the foremost function to allow the program to start out up
and motivate its functions.
C++ program can support unions and structures that are a
mix of stand-alone and put-together files, It uses the
standard C++ application mentioned as “.cpp”, C++ uses the
reserved library word mentioned as “goto” that’s the same
as Java’s continue, or break commands.
The global data and global functions are used within C++
that aren’t utilized in many other high-level languages
within the pc sciences and it is an advantage to the
programming languages.
As C++ doesn’t use the objects, it’s difficult to make the
programs that have inheritance data and thus the
reformed the programs to contribute to the other data and
therefore the programs, it is possible to undertake to the
present, however, but is difficult, These inheritance data
and programs are mentioned because of the inheritance
trees.
C++ doesn’t support class methods that are faithful away,
but class methods are basically functions, and sometimes
they’re referred to as functions.
C++ program uses multi-paradigm programming,
Paradigm means the planning of programming, paradigm
concerned about the logic, the structure, and procedure of
program, C++ program is multi-paradigm means it follows
three paradigms Generic, Imperative, Object-Oriented.
19
C++ program is useful for low-level programming language
and really efficient for general purposes, It offers
performance and memory efficiently, It offers high-level
abstraction, within the language of the matter domain
C++ may be a system programming and features a
relatively clear and mature standard,
C++ program supports inline function, C++ supports
exception handling, it’s pointer and references, C++ uses
cin and cout.
C++ has a large and mature ecosystem of libraries and
frameworks that can be used to accelerate development
and simplify tasks like network programming, graphics
rendering, and database access.

Disadvantages of C++:
One major problem in C++ is when the info points to an
equivalent thing from two different starting points, this
causes a serious problem, the C++ program will still have
involved problems within the coding.
Java’s uni-code to the ASCII rules is 16-bit, while C++
program is 8-bit only, So, C++ may be a less impressive
programming language but saves the memory.
C++ program is complex during a very large high-level
program, C++ is employed for platform-specific
application commonly, For the actual OS or platform, the
library set is typically chosen.

20
C++ program can’t support garbage pickup, It’s not secure
because it’s a pointer, friend function, and global variable
and it’s no support for threads built-in.
C++ programs are often heavy if it’s not careful, C++
program allows classes and thus the functions with an
equivalent name and overloaded functions thus the
symbol mangling system must be used, It can easily be
wrapped in C functions though.
C++ program has no notion of being fast and it’s not used
for platform-dependent apps any longer than C or
anything is.
Actually, given the character of the toolchain, it’s probably
less dependent than others.
Complex in a very large high-level program.
It is used for platform-specific applications commonly.
For a specific OS or platform, the library set is typically
chosen that locks.

C++ is a low-level language and hence it can


be more difficult to maintain and debug compared to
higher-level languages that provide more abstraction and
automation.
C++ is a complex and powerful language that can take time
to learn and master, especially for beginners who are new
to programming.

21
Features of c++
enhancement of the C language to include an object-
oriented paradigm. It is an imperative and compiled
language. C++ has a number of features, including:
• Object-Oriented Programming
• Machine Independent
• Simple
• High-Level Language
• Popular
• Case-sensitive
• Compiler Based
• Dynamic Memory Allocation
• Memory Management
• Multi-threading

1. Object-Oriented Programming
C++ is an Object-Oriented Programming Language, unlike
C which is a procedural programming language. This is the
most important feature of C++.
It can create/destroy objects while programming. Also, It
can create blueprints with which objects can be created.
We have discussed the Object-Orient Programming
Concepts in C++ in this article.

22
Concepts of Object-oriented programming Language:

2. Machine Independent
A C++ executable is not platform-independent (compiled
programs on Linux won’t run on Windows), however, they
are machine-independent.
Let us understand this feature of C++ with the help of an
example.
Suppose you have written a piece of code that can run on
Linux/Windows/Mac OSx which makes the C++ Machine
Independent but the executable file of the C++ cannot run
on different operating systems.

3. Simple
It is a simple language in the sense that programs can be
broken down into logical units and parts, has rich library
support and has a variety of data types.
Also, the Auto Keyword of C++ makes life easier.

4. High-Level Language
C++ is a High-Level Language, unlike C which is a Mid-
Level Programming Language.
It makes life easier to work in C++ as it is a high-level
language it is closely associated with the human-
comprehensible English language.

23
5. Popular
C++ can be the base language for many other
programming languages that supports the feature of
object-oriented programming.
Bjarne Stroustrup found Simula 67, the first object-
oriented language ever, lacking simulations, and decided to
develop C++.

6. Case-sensitive
It is clear that C++ is a case-sensitive programming
language. For example, cin is used to take input from the
input stream.
But if the “Cin” won’t work. Other languages like HTML
and MySQL are not case-sensitive languages.

7. Compiler Based
C++ is a compiler-based language, unlike Python. That is
C++ programs used to be compiled and their executable
file is used to run them.
C++ is a relatively faster language than Java and Python.

8. Dynamic Memory Allocation


When the program executes in C++ then the variables are
allocated the dynamical heap space.
24
Inside the functions, the variables are allocated in the
stack space. Many times, We are not aware in advance how
much memory is needed to store particular information in
a defined variable and the size of required memory can be
determined at run time.

9. Memory Management
• C++ allows us to allocate the memory of a variable or
an array in run time. This is known as Dynamic Memory
Allocation.
• In other programming languages such as Java and
Python, the compiler automatically manages the memories
allocated to variables. But this is not the case in C++.
• In C++, the memory must be de-allocated dynamically
allocated memory manually after it is of no use.
• The allocation and deallocation of the memory can be
done using the new and delete operators respectively.

10. Multi-threading
• Multithreading is a specialized form of multitasking
and multitasking is a feature that allows your system to
execute two or more programs concurrently. In general,
there are two sorts of multitasking: process-based and
thread-based.

25
• Process-based multitasking handles the concurrent
execution of programs. Thread-based multitasking deals
with the multiprogramming of pieces of an equivalent
program.
• A multithreaded program contains two or more parts
that will run concurrently. Each part of such a program is
named a thread, and every thread defines a separate path
of execution.
• C++ doesn’t contain any built-in support for
multithreaded applications. Instead, it relies entirely upon
the OS to supply this feature.

26
What is c++ used for?

What makes C++ unique?


C++ is a general-purpose programming language, created
by Bjarne Stroustrup and his team at Bell Laboratories in
1979.
Over the decades, C++ has become the language of choice
for certain kinds of applications.
C++ is most popularly used for building large software
infrastructure and applications that run on limited
resources.
Because C++ can directly manipulate the hardware (or
machine) that it runs on, programmers can fine-tune their
code to run efficiently in any environment, even when
there’s limited hardware space or energy available to
power the application.
This translates to applications that run quickly and
reliably on a variety of devices, making C++ ideal for
forming the base layer of many important applications.
For these reasons, C++ is an excellent choice for building
software that is fast, efficient at managing system
resources, and reliable in performing critical tasks.
What is C++ used for?
C++ can be found in a wide variety of industries. Check out
the following list for some of the most notable, interesting,
and even surprising real-world applications of C++.

27
 Operating systems
C++ plays an important part in well-known operating
systems, from MacOS and Windows to mobile operating
systems like iOS.
In general, operating systems need to be fast and efficient
at managing system resources.
With the low-level (close to machine code) capabilities of
C++, developers can structure their code to make even the
smallest details of an operating system fast and energy
efficient.
 Game development
C++ is one of the most widely-used programming
languages in game development.
It has been used to create: games, such as World of
Warcraft, Counter-Strike, and StarCraft, game engines like
Unreal Engine, and gaming consoles, including Xbox,
PlayStation, and Nintendo Switch.
Gaming involves lots of resource-intensive functions,
whether it’s generating graphics or facilitating multiplayer
sessions.
C++ helps in optimizing the use of resources, such as
allowing programmers to adjust exactly how data
structures and memory allocation are handled.
 IoT devices
IoT (Internet of Things) devices include embedded
systems that often rely on C++. Some examples of these

28
devices are appliances, cars, smartwatches, TVs, and
medical devices.
Because the hardware is often embedded inside of an
object, these devices have to operate with limited
computing resources and strict power requirements.
C++ helps programmers control how these resources are
used in order to run programs more efficiently.
 Databases
C++ is used to build popular database tools like MySQL
and MongoDB. These databases form the backbone of
many well-known applications, including ones created by
Google, Netflix, YouTube, Adobe, and more.
C++ is ideal for helping structure databases to support
efficient storage.
 Web browsers
C++ plays a role in web browsers, such as Google Chrome,
Mozilla Firefox, Safari, and Opera. It is used to develop
back-end services that retrieve information from
databases and render code into interactive web pages.
C++ helps web browsers carry out these tasks with speed
and minimal delays, which means we don’t have to wait
long for content to appear on our screens.
 Machine learning tools
Machine learning tools, such as TensorFlow, rely on C++ as
a back-end programming language. Even though data
scientists can use TensorFlow with Python, for example,

29
the core machine learning calculations are carried out
with C++ code.
In fact, C++ has a large collection of libraries that power
these highly-sophisticated calculations that train machine
learning models.
 AR/VR applications
C++ is widely used for developing augmented reality and
virtual reality applications. In fact, many of these
applications run on Unreal Engine, which is built using
C++.
AR/VR applications need to handle large amounts of data
that adjust continuously based on input from camera
sensors and user interactions.

C++ is ideal for helping process all of this data while


creating seamless virtual experiences.
 Scientific research
C++ plays a notable role in scientific research, from space
exploration to high-energy particle physics. At CERN,
scientists use C++ for analyzing data on subatomic
particles that can help answer questions about how our
universe originated.
At NASA, C++ has been used to build autonomous driving
systems that help the Mars Rovers navigate unknown
terrain.

30
Many parts of the International Space Station are built
using C++ as well.
 Financial tools
Many banks and financial institutions use C++ to build
their software infrastructure, which powers applications
for banking, trading, and financial modeling.
The speed and reliable performance of C++ is ideal for
processing millions of daily transactions, facilitating a high
volume and frequency of trades, and creating data
simulations for large portfolios.
 Flight software
C++ is a commonly-used language for flight software that
powers commercial airplanes and military and defense
aircraft (such as the F-16 and F-35 planes).
C++ is used to build a lot of the safety-critical software,
which is required to follow strict coding standards to make
sure that the wings, engines, and other critical parts work
predictably during each flight.
 Google search engine
Google’s search engine relies on C++ to make sure that
search results show up quickly and with minimal response
time.
C++ also powers the machine learning and other complex
algorithms that make sure we get the best possible results
for our search.

31
Google’s crawling and indexing infrastructure is also
implemented in C++.
 Medical technology
C++ can be found in a variety of medical applications, from
MRI machines to lab testing equipment to systems that
handle patient information.
C++ is also used to model data and run data simulations
for bioinformatics research, because many advanced
algorithms written for the medical and biological sciences
are implemented in C++.
 Telecommunications
C++ is widely used in building telephone, Internet, and
other telecommunications infrastructure.
It’s ideal for managing resources to handle tons of
simultaneous communication with speed and efficiency.
 Movie production
Many of the graphics and special effects that you see in
movies are created with C++.
C++ is great for this role because it can handle large files
with high-quality footage and run many of the advanced
calculations that make the special effects possible.
 Getting Started
Just about everywhere you look, you’ll find that C++ is
involved in some way! If you want to explore even more
real-world examples of C++ in action, see this list of C++
Applications.
32
And if you’re feeling inspired to learn more about the
world of C++, check out our Learn C++ course for an
introduction to the fundamental concepts behind one of
the world’s most widely-used programming languages.

History of c++

 C++:
C++ (/ˈsiː plʌs plʌs/, pronounced "C plus plus" and
sometimes abbreviated as CPP) is a high-level, general-
purpose programming language created by Danish
computer scientist Bjarne Stroustrup.
First released in 1985 as an extension of the C
programming language, it has since expanded significantly
over time; modern C++ currently has object-oriented,
generic, and functional features, in addition to facilities for
low-level memory manipulation.
It is almost always implemented as a compiled language,
and many vendors provide C++ compilers, including the
Free Software Foundation, LLVM, Microsoft, Intel,
Embarcadero, Oracle, and IBM.[13]
C++ was designed with systems programming and
embedded, resource-constrained software and large
systems in mind, with performance, efficiency, and
flexibility of use as its design highlights.
[14] C++ has also been found useful in many other
contexts, with key strengths being software infrastructure
33
and resource-constrained applications,[14] including
desktop applications, video games, servers (e.g. e-
commerce, web search, or databases), and performance-
critical applications (e.g. telephone switches or space
probes).[15]
C++ is standardized by the International Organization for
Standardization (ISO), with the latest standard version
ratified and published by ISO in December 2020 as
ISO/IEC 14882:2020 (informally known as C++20).
[16] The C++ programming language was initially
standardized in 1998 as ISO/IEC 14882:1998, which was
then amended by the C++03, C++11, C++14, and C++17
standards.
The current C++20 standard supersedes these with new
features and an enlarged standard library. Before the
initial standardization in 1998, C++ was developed by
Stroustrup at Bell Labs since 1979 as an extension of the C
language; he wanted an efficient and flexible language
similar to C that also provided high-level features for
program organization.
[17] Since 2012, C++ has been on a three-year release
schedule[18] with C++23 as the next planned
standard.[19]

 History
Bjarne Stroustrup, the creator of C++, in his AT&T New
Jersey office, c. 2000

34
In 1979, Bjarne Stroustrup, a Danish computer scientist,
began work on "C with Classes", the predecessor to C++.
[20] The motivation for creating a new language
originated from Stroustrup's experience in programming
for his PhD thesis. Stroustrup found that Simula had
features that were very helpful for large software
development, but the language was too slow for practical
use, while BCPL was fast but too low-level to be suitable
for large software development.
When Stroustrup started working in AT&T Bell Labs, he
had the problem of analyzing the UNIX kernel with respect
to distributed computing. Remembering his PhD
experience, Stroustrup set out to enhance the C language
with Simula-like features.
[21] C was chosen because it was general-purpose, fast,
portable and widely used. As well as C and Simula's
influences, other languages also influenced this new
language, including ALGOL 68, Ada, CLU and ML.
Initially, Stroustrup's "C with Classes" added features to
the C compiler, Cpre, including classes, derived classes,
strong typing, inlining and default arguments.[22]

In 1982, Stroustrup started to develop a successor to C


with Classes, which he named "C++" (++ being the
increment operator in C) after going through several other
names.

35
New features were added, including virtual functions,
function name and operator overloading, references,
constants, type-safe free-store memory allocation
(new/delete), improved type checking, and BCPL style
single-line comments with two forward slashes (//).
Furthermore, Stroustrup developed a new, standalone
compiler for C++, Cfront.
In 1984, Stroustrup implemented the first stream
input/output library.
The idea of providing an output operator rather than a
named output function was suggested by Doug McIlroy[1]
(who had previously suggested Unix pipes).
In 1985, the first edition of The C++ Programming
Language was released, which became the definitive
reference for the language, as there was not yet an official
standard.
[23] The first commercial implementation of C++ was
released in October of the same year.[20]
In 1989, C++ 2.0 was released, followed by the updated
second edition of The C++ Programming Language in
1991.
[24] New features in 2.0 included multiple inheritance,
abstract classes, static member functions, const member
functions, and protected members. In 1990, The
Annotated C++ Reference Manual was published.

36
This work became the basis for the future standard. Later
feature additions included templates, exceptions,
namespaces, new casts, and a Boolean type.
In 1998, C++98 was released, standardizing the language,
and a minor update (C++03) was released in 2003.
After C++98, C++ evolved relatively slowly until, in 2011,
the C++11 standard was released, adding numerous new
features, enlarging the standard library further, and
providing more facilities to C++ programmers. After a
minor C++14 update released in December 2014, various
new additions were introduced in C++17.
[25] After becoming finalized in February 2020,[26] a
draft of the C++20 standard was approved on 4 September
2020 and officially published on 15 December
2020.[27][28]
On January 3, 2018, Stroustrup was announced as the
2018 winner of the Charles Stark Draper Prize for
Engineering, "for conceptualizing and developing the C++
programming language".[29]
As of December 2022 C++ ranked third on the TIOBE
index, surpassing Java for the first time in the history of
the index. It ranks 3rd, after Python and C.[30]
 Etymology
According to Stroustrup, "the name signifies the
evolutionary nature of the changes from C".[31] This name
is credited to Rick Mascitti (mid-1983)[22] and was first
used in December 1983.

37
When Mascitti was questioned informally in 1992 about
the naming, he indicated that it was given in a tongue-in-
cheek spirit.
The name comes from C's ++ operator (which increments
the value of a variable) and a common naming convention
of using "+" to indicate an enhanced computer program.
During C++'s development period, the language had been
referred to as "new C" and "C with Classes"[22][32] before
acquiring its final name.
 Philosophy
Throughout C++'s life, its development and evolution has
been guided by a set of principles:[21]
• It must be driven by actual problems and its features
should be immediately useful in real world programs.
• Every feature should be implementable (with a
reasonably obvious way to do so).
• Programmers should be free to pick their own
programming style, and that style should be fully
supported by C++.
• Allowing a useful feature is more important than
preventing every possible misuse of C++.
• It should provide facilities for organising programs
into separate, well-defined parts, and provide facilities for
combining separately developed parts.

38
• No implicit violations of the type system (but allow
explicit violations; that is, those explicitly requested by the
programmer).
• User-created types need to have the same support
and performance as built-in types.
• Unused features should not negatively impact created
executables (e.g. in lower performance).
• There should be no language beneath C++ (except
assembly language).
• C++ should work alongside other existing
programming languages, rather than fostering its own
separate and incompatible programming environment.
• If the programmer's intent is unknown, allow the
programmer to specify it by providing manual control.
 Standardization
C++ is standardized by an ISO working group known as
JTC1/SC22/WG21. So far, it has published six revisions of
the C++ standard and is currently working on the next
revision, C++23.
In 1998, the ISO working group standardized C++ for the
first time as ISO/IEC 14882:1998, which is informally
known as C++98. In 2003, it published a new version of
the C++ standard called ISO/IEC 14882:2003, which fixed
problems identified in C++98.
The next major revision of the standard was informally
referred to as "C++0x", but it was not released until

39
2011.[39] C++11 (14882:2011) included many additions
to both the core language and the standard library.[36]
In 2014, C++14 (also known as C++1y) was released as a
small extension to C++11, featuring mainly bug fixes and
small improvements.[40] The Draft International Standard
ballot procedures completed in mid-August 2014.[41]
After C++14, a major revision C++17, informally known as
C++1z, was completed by the ISO C++ committee in mid
July 2017 and was approved and published in December
2017.[42]
As part of the standardization process, ISO also publishes
technical reports and specifications:
• ISO/IEC TR 18015:2006[43] on the use of C++ in
embedded systems and on performance implications of
C++ language and library features,
• ISO/IEC TR 19768:2007[44] (also known as the C++
Technical Report 1) on library extensions mostly
integrated into C++11,
• ISO/IEC TR 29124:2010[45] on special mathematical
functions, integrated into C++17
• ISO/IEC TR 24733:2011[46] on decimal floating-
point arithmetic,
• ISO/IEC TS 18822:2015[47] on the standard
filesystem library, integrated into C++17
• ISO/IEC TS 19570:2015[48] on parallel versions of
the standard library algorithms, integrated into C++17

40
• ISO/IEC TS 19841:2015[49] on software
transactional memory,
• ISO/IEC TS 19568:2015[50] on a new set of library
extensions, some of which are already integrated into
C++17,
• ISO/IEC TS 19217:2015[51] on the C++ concepts,
integrated into C++20
• ISO/IEC TS 19571:2016[52] on the library extensions
for concurrency, some of which are already integrated into
C++20
• ISO/IEC TS 19568:2017[53] on a new set of general-
purpose library extensions
• ISO/IEC TS 21425:2017[54] on the library extensions
for ranges, integrated into C++20
• ISO/IEC TS 22277:2017[55] on coroutines, integrated
into C++20
• ISO/IEC TS 19216:2018[56] on the networking
library
• ISO/IEC TS 21544:2018[57] on modules, integrated
into C++20
• ISO/IEC TS 19570:2018[58] on a new set of library
extensions for parallelism
• ISO/IEC TS 23619:2021[59] on new extensions
 Reflection Language
The C++ language has two main components: a direct
mapping of hardware features provided primarily by the C
41
subset, and zero-overhead abstractions based on those
mappings.
Stroustrup describes C++ as "a light-weight abstraction
programming language [designed] for building and using
efficient and elegant abstractions";[14] and "offering both
hardware access and abstraction is the basis of C++.
Doing it efficiently is what distinguishes it from other
languages."[61]
C++ inherits most of C's syntax. The following is Bjarne
Stroustrup's version of the Hello world program that uses
the C++ Standard Library stream facility to write a
message to standard output:

 Object storage
As in C, C++ supports four types of memory management:
static storage duration objects, thread storage duration
objects, automatic storage duration objects, and dynamic
storage duration objects.[64]
 Static storage duration objects
Static storage duration objects are created before main() is
entered (see exceptions below) and destroyed in reverse
order of creation after main() exits.
The exact order of creation is not specified by the
standard (though there are some rules defined below) to
allow implementations some freedom in how to organize
their implementation.

42
More formally, objects of this type have a lifespan that
"shall last for the duration of the program".[65]
Static storage duration objects are initialized in two
phases. First, "static initialization" is performed, and only
after all static initialization is performed, "dynamic
initialization" is performed.
In static initialization, all objects are first initialized with
zeros; after that, all objects that have a constant
initialization phase are initialized with the constant
expression (i.e. variables initialized with a literal or
constexpr). Though it is not specified in the standard, the
static initialization phase can be completed at compile
time and saved in the data partition of the executable.
Dynamic initialization involves all object initialization
done via a constructor or function call (unless the function
is marked with constexpr, in C++11).
The dynamic initialization order is defined as the order of
declaration within the compilation unit (i.e. the same file).
No guarantees are provided about the order of
initialization between compilation units.
 Thread storage duration objects
Variables of this type are very similar to static storage
duration objects. The main difference is the creation time
is just prior to thread creation and destruction is done
after the thread has been joined.[66]
 Automatic storage duration objects

43
The most common variable types in C++ are local variables
inside a function or block, and temporary variables.[67]
The common feature about automatic variables is that
they have a lifetime that is limited to the scope of the
variable.
They are created and potentially initialized at the point of
declaration (see below for details) and destroyed in the
reverse order of creation when the scope is left.
This is implemented by allocation on the stack.
Local variables are created as the point of execution passes
the declaration point. If the variable has a constructor or
initializer this is used to define the initial state of the
object. Local variables are destroyed when the local block
or function that they are declared in is closed.
C++ destructors for local variables are called at the end of
the object lifetime, allowing a discipline for automatic
resource management termed RAII, which is widely used
in C++.
Member variables are created when the parent object is
created. Array members are initialized from 0 to the last
member of the array in order.
Member variables are destroyed when the parent object is
destroyed in the reverse order of creation. i.e. If the parent
is an "automatic object" then it will be destroyed when it
goes out of scope which triggers the destruction of all its
members.

44
Temporary variables are created as the result of
expression evaluation and are destroyed when the
statement containing the expression has been fully
evaluated (usually at the ; at the end of a statement).
 Dynamic storage duration objects
These objects have a dynamic lifespan and can be created
directly with a call to new and destroyed explicitly with a
call to delete.
[68] C++ also supports malloc and free, from C, but these
are not compatible with new and delete. Use of new
returns an address to the allocated memory.
The C++ Core Guidelines advise against using new directly
for creating dynamic objects in favor of smart pointers
through make_unique<T> for single ownership and
make_shared<T> for reference-counted multiple
ownership,[69] which were introduced in C++11.
 Templates
C++ templates enable generic programming. C++ supports
function, class, alias, and variable templates.
Templates may be parameterized by types, compile-time
constants, and other templates. Templates are
implemented by instantiation at compile-time.
To instantiate a template, compilers substitute specific
arguments for a template's parameters to generate a
concrete function or class instance.

45
Some substitutions are not possible; these are eliminated
by an overload resolution policy described by the phrase
"Substitution failure is not an error" (SFINAE).
Templates are a powerful tool that can be used for generic
programming, template metaprogramming, and code
optimization, but this power implies a cost.
Template use may increase code size, because each
template instantiation produces a copy of the template
code: one for each set of template arguments, however,
this is the same or smaller amount of code that would be
generated if the code was written by hand.
[70] This is in contrast to run-time generics seen in other
languages (e.g., Java) where at compile-time the type is
erased and a single template body is preserved.
Templates are different from macros: while both of these
compile-time language features enable conditional
compilation, templates are not restricted to lexical
substitution.
Templates are aware of the semantics and type system of
their companion language, as well as all compile-time type
definitions, and can perform high-level operations
including programmatic flow control based on evaluation
of strictly type-checked parameters.
Macros are capable of conditional control over compilation
based on predetermined criteria, but cannot instantiate
new types, recurse, or perform type evaluation and in
effect are limited to pre-compilation text-substitution and
text-inclusion/exclusion.
46
In other words, macros can control compilation flow
based on pre-defined symbols but cannot, unlike
templates, independently instantiate new symbols.
Templates are a tool for static polymorphism (see below)
and generic programming.
In addition, templates are a compile-time mechanism in
C++ that is Turing-complete, meaning that any
computation expressible by a computer program can be
computed, in some form, by a template metaprogram prior
to runtime.
In summary, a template is a compile-time parameterized
function or class written without knowledge of the specific
arguments used to instantiate it.
After instantiation, the resulting code is equivalent to code
written specifically for the passed arguments.
In this manner, templates provide a way to decouple
generic, broadly applicable aspects of functions and
classes (encoded in templates) from specific aspects
(encoded in template parameters) without sacrificing
performance due to abstraction.
 Objects
C++ introduces object-oriented programming (OOP)
features to C. It offers classes, which provide the four
features commonly present in OOP (and some non-OOP)
languages: abstraction, encapsulation, inheritance, and
polymorphism.

47
One distinguishing feature of C++ classes compared to
classes in other programming languages is support for
deterministic destructors, which in turn provide support
for the Resource Acquisition is Initialization (RAII)
concept.
 Encapsulation
Encapsulation is the hiding of information to ensure that
data structures and operators are used as intended and to
make the usage model more obvious to the developer.
C++ provides the ability to define classes and functions as
its primary encapsulation mechanisms.
Within a class, members can be declared as either public,
protected, or private to explicitly enforce encapsulation.
A public member of the class is accessible to any function.
A private member is accessible only to functions that are
members of that class and to functions and classes
explicitly granted access permission by the class
("friends").
A protected member is accessible to members of classes
that inherit from the class in addition to the class itself and
any friends.
The object-oriented principle ensures the encapsulation of
all and only the functions that access the internal
representation of a type.
C++ supports this principle via member functions and
friend functions, but it does not enforce it.

48
Programmers can declare parts or all of the
representation of a type to be public, and they are allowed
to make public entities not part of the representation of a
type.
Therefore, C++ supports not just object-oriented
programming, but other decomposition paradigms such as
modular programming.
It is generally considered good practice to make all data
private or protected, and to make public only those
functions that are part of a minimal interface for users of
the class.
This can hide the details of data implementation, allowing
the designer to later fundamentally change the
implementation without changing the interface in any
way.[71][72]
 Inheritance
Inheritance allows one data type to acquire properties of
other data types. Inheritance from a base class may be
declared as public, protected, or private.
This access specifier determines whether unrelated and
derived classes can access the inherited public and
protected members of the base class. Only public
inheritance corresponds to what is usually meant by
"inheritance".
The other two forms are much less frequently used. If the
access specifier is omitted, a "class" inherits privately,
while a "struct" inherits publicly.

49
Base classes may be declared as virtual; this is called
virtual inheritance.
Virtual inheritance ensures that only one instance of a
base class exists in the inheritance graph, avoiding some of
the ambiguity problems of multiple inheritance.
Multiple inheritance is a C++ feature allowing a class to be
derived from more than one base class; this allows for
more elaborate inheritance relationships.
For example, a "Flying Cat" class can inherit from both
"Cat" and "Flying Mammal". Some other languages, such as
C# or Java, accomplish something similar (although more
limited) by allowing inheritance of multiple interfaces
while restricting the number of base classes to one
(interfaces, unlike classes, provide only declarations of
member functions, no implementation or member data).
An interface as in C# and Java can be defined in C++ as a
class containing only pure virtual functions, often known
as an abstract base class or "ABC".
The member functions of such an abstract base class are
normally explicitly defined in the derived class, not
inherited implicitly.
C++ virtual inheritance exhibits an ambiguity resolution
feature called dominance.
Main article: Operators in C and C++
C++ provides more than 35 operators, covering basic
arithmetic, bit manipulation, indirection, comparisons,
logical operations and others.
50
Almost all operators can be overloaded for user-defined
types, with a few notable exceptions such as member
access (. and .*) as well as the conditional operator.
The rich set of overloadable operators is central to making
user-defined types in C++ seem like built-in types.
Overloadable operators are also an essential part of many
advanced C++ programming techniques, such as smart
pointers.
Overloading an operator does not change the precedence
of calculations involving the operator, nor does it change
the number of operands that the operator uses (any
operand may however be ignored by the operator, though
it will be evaluated prior to execution).
Overloaded "&&" and "||" operators lose their short-circuit
evaluation property.
 Polymorphism
Polymorphism enables one common interface for many
implementations, and for objects to act differently under
different circumstances.
C++ supports several kinds of static (resolved at compile-
time) and dynamic (resolved at run-time) polymorphisms,
supported by the language features described above.
Compile-time polymorphism does not allow for certain
run-time decisions, while runtime polymorphism typically
incurs a performance penalty.
 Static polymorphism

51
Function overloading allows programs to declare multiple
functions having the same name but with different
arguments (i.e. ad hoc polymorphism).
The functions are distinguished by the number or types of
their formal parameters.
Thus, the same function name can refer to different
functions depending on the context in which it is used.
The type returned by the function is not used to
distinguish overloaded functions and differing return
types would result in a compile-time error message.
When declaring a function, a programmer can specify for
one or more parameters a default value.
Doing so allows the parameters with defaults to optionally
be omitted when the function is called, in which case the
default arguments will be used.
When a function is called with fewer arguments than there
are declared parameters, explicit arguments are matched
to parameters in left-to-right order, with any unmatched
parameters at the end of the parameter list being assigned
their default arguments.
In many cases, specifying default arguments in a single
function declaration is preferable to providing overloaded
function definitions with different numbers of parameters.
Templates in C++ provide a sophisticated mechanism for
writing generic, polymorphic code (i.e. parametric
polymorphism).

52
In particular, through the curiously recurring template
pattern, it is possible to implement a form of static
polymorphism that closely mimics the syntax for
overriding virtual functions. Because C++ templates are
type-aware and Turing-complete, they can also be used to
let the compiler resolve recursive conditionals and
generate substantial programs through template
metaprogramming.
Contrary to some opinion, template code will not generate
a bulk code after compilation with the proper compiler
settings.[70]
 Dynamic polymorphism
Variable pointers and references to a base class type in
C++ can also refer to objects of any derived classes of that
type. This allows arrays and other kinds of containers to
hold pointers to objects of differing types (references
cannot be directly held in containers).
This enables dynamic (run-time) polymorphism, where
the referred objects can behave differently, depending on
their (actual, derived) types.
C++ also provides the dynamic_cast operator, which allows
code to safely attempt conversion of an object, via a base
reference/pointer, to a more derived type: downcasting.
The attempt is necessary as often one does not know
which derived type is referenced.
(Upcasting, conversion to a more general type, can always
be checked/performed at compile-time via static_cast, as

53
ancestral classes are specified in the derived class's
interface, visible to all callers.)
dynamic_cast relies on run-time type information (RTTI),
metadata in the program that enables differentiating types
and their relationships. If a dynamic_cast to a pointer fails,
the result is the nullptr constant, whereas if the
destination is a reference (which cannot be null), the cast
throws an exception.
Objects known to be of a certain derived type can be cast
to that with static_cast, bypassing RTTI and the safe
runtime type-checking of dynamic_cast, so this should be
used only if the programmer is very confident the cast is,
and will always be, valid.
 Virtual member functions
Ordinarily, when a function in a derived class overrides a
function in a base class, the function to call is determined
by the type of the object. A given function is overridden
when there exists no difference in the number or type of
parameters between two or more definitions of that
function. Hence, at compile time, it may not be possible to
determine the type of the object and therefore the correct
function to call, given only a base class pointer; the
decision is therefore put off until runtime. This is called
dynamic dispatch.
Virtual member functions or methods[73] allow the most
specific implementation of the function to be called,
according to the actual run-time type of the object. In C++
implementations, this is commonly done using virtual
54
function tables. If the object type is known, this may be
bypassed by prepending a fully qualified class name before
the function call, but in general calls to virtual functions
are resolved at run time.
In addition to standard member functions, operator
overloads and destructors can be virtual. An inexact rule
based on practical experience states that if any function in
the class is virtual, the destructor should be as well. As the
type of an object at its creation is known at compile time,
constructors, and by extension copy constructors, cannot
be virtual.
Nonetheless, a situation may arise where a copy of an
object needs to be created when a pointer to a derived
object is passed as a pointer to a base object. In such a
case, a common solution is to create a clone() (or similar)
virtual function that creates and returns a copy of the
derived class when called.
A member function can also be made "pure virtual" by
appending it with = 0 after the closing parenthesis and
before the semicolon. A class containing a pure virtual
function is called an abstract class. Objects cannot be
created from an abstract class; they can only be derived
from.
Any derived class inherits the virtual function as pure and
must provide a non-pure definition of it (and all other pure
virtual functions) before objects of the derived class can be
created. A program that attempts to create an object of a

55
class with a pure virtual member function or inherited
pure virtual member function is ill-formed.
 Lambda expressions
Since C++20, the keyword template is optional for
template parameters of lambda expressions:
If the lambda takes no parameters, and no return type or
other specifiers are used, the () can be omitted, that is,
The return type of a lambda expression can be
automatically inferred, if possible, e.g.:
The [capture] list supports the definition of closures. Such
lambda expressions are defined in the standard as
syntactic sugar for an unnamed function object.
 Exception handling
Exception handling is used to communicate the existence
of a runtime problem or error from where it was detected
to where the issue can be handled.[75] It permits this to be
done in a uniform manner and separately from the main
code, while detecting all errors.
[76] Should an error occur, an exception is thrown
(raised), which is then caught by the nearest suitable
exception handler. The exception causes the current scope
to be exited, and also each outer scope (propagation) until
a suitable handler is found, calling in turn the destructors
of any objects in these exited scopes.
[77] At the same time, an exception is presented as an
object carrying the data about the detected problem.[78]

56
Some C++ style guides, such as Google's,[79] LLVM's,[80]
and Qt's[81] forbid the usage of exceptions.
The exception-causing code is placed inside a try block.
The exceptions are handled in separate catch blocks (the
handlers); each try block can have multiple exception
handlers, as it is visible in the example below.[82]
It is also possible to raise exceptions purposefully, using
the throw keyword; these exceptions are handled in the
usual way. In some cases, exceptions cannot be used due to
technical reasons.
One such example is a critical component of an embedded
system, where every operation must be guaranteed to
complete within a specified amount of time. This cannot
be determined with exceptions as no tools exist to
determine the maximum time required for an exception to
be handled.[83]
Unlike signal handling, in which the handling function is
called from the point of failure, exception handling exits
the current scope before the catch block is entered, which
may be located in the current function or any of the
previous function calls currently on the stack.
 Enumerated types
C++ has enumeration types that are directly inherited
from C's and work mostly like these, except that an
enumeration is a real type in C++, giving added compile-
time checking.

57
Also (as with structs), the C++ enum keyword is combined
with a typedef, so that instead of naming the type enum
name, simply name it name.
This can be simulated in C using a typedef: typedef enum
{Value1, Value2} name;
C++11 also provides a second kind of enumeration, called
a scoped enumeration. These are type-safe: the
enumerators are not implicitly converted to an integer
type.
Among other things, this allows I/O streaming to be
defined for the enumeration type. Another feature of
scoped enumerations is that the enumerators do not leak,
so usage requires prefixing with the name of the
enumeration (e.g., Color::Red for the first enumerator in
the example below), unless a using enum declaration
(introduced in C++20) has been used to bring the
enumerators into the current scope.
A scoped enumeration is specified by the phrase enum
class (or enum struct). For example:
The underlying type of an enumeration is an
implementation-defined integral type that is large enough
to hold all enumerated values; it does not have to be the
smallest possible type.
The underlying type can be specified directly, which allows
"forward declarations" of enumerations:
 Standard library

58
The C++ standard consists of two parts: the core language
and the standard library. C++ programmers expect the
latter on every major implementation of C++[clarify]; it
includes aggregate types (vectors, lists, maps, sets, queues,
stacks, arrays, tuples), algorithms (find, for_each,
binary_search, random_shuffle, etc.),
input/output facilities (iostream, for reading from and
writing to the console and files), filesystem library,
localisation support, smart pointers for automatic memory
management, regular expression support, multi-threading
library, atomics support (allowing a variable to be read or
written to by at most one thread at a time without any
external synchronisation), time utilities (measurement,
getting current time, etc.), a system for converting error
reporting that does not use C++ exceptions into C++
exceptions, a random number generator and a slightly
modified version of the C standard library (to make it
comply with the C++ type system).
A large part of the C++ library is based on the Standard
Template Library (STL). Useful tools provided by the STL
include containers as the collections of objects (such as
vectors and lists), iterators that provide array-like access
to containers, and algorithms that perform operations
such as searching and sorting.
Furthermore, (multi)maps (associative arrays) and
(multi)sets are provided, all of which export compatible
interfaces. Therefore, using templates it is possible to
write generic algorithms that work with any container or
on any sequence defined by iterators.
59
As in C, the features of the library are accessed by using
the #include directive to include a standard header. The
C++ Standard Library provides 105 standard headers, of
which 27 are deprecated.
The standard incorporates the STL that was originally
designed by Alexander Stepanov, who experimented with
generic algorithms and containers for many years.
When he started with C++, he finally found a language
where it was possible to create generic algorithms (e.g.,
STL sort) that perform even better than, for example, the C
standard library qsort, thanks to C++ features like using
inlining and compile-time binding instead of function
pointers.
The standard does not refer to it as "STL", as it is merely a
part of the standard library, but the term is still widely
used to distinguish it from the rest of the standard library
(input/output streams, internationalization, diagnostics,
the C library subset, etc.).[84]
Most C++ compilers, and all major ones, provide a
standards-conforming implementation of the C++
standard library.
 C++ Core Guidelines
The C++ Core Guidelines[85] are an initiative led by Bjarne
Stroustrup, the inventor of C++, and Herb Sutter, the
convener and chair of the C++ ISO Working Group, to help
programmers write 'Modern C++' by using best practices
for the language standards C++11 and newer, and to help

60
developers of compilers and static checking tools to create
rules for catching bad programming practices.
The main aim is to efficiently and consistently write type
and resource safe C++.
The Core Guidelines were announced[86] in the opening
keynote at CPPCon 2015.
The Guidelines are accompanied by the Guideline Support
Library (GSL),[87] a header only library of types and
functions to implement the Core Guidelines and static
checker tools for enforcing Guideline rules.[88]
 Compatibility
To give compiler vendors greater freedom, the C++
standards committee decided not to dictate the
implementation of name mangling, exception handling,
and other implementation-specific features.
The downside of this decision is that object code
produced by different compilers is expected to be
incompatible. There were, however, attempts to
standardize compilers for particular machines or
operating systems (for example C++ ABI),[89] though they
seem to be largely abandoned now.
 With C
C++ is often considered to be a superset of C but this is not
strictly true.[90] Most C code can easily be made to
compile correctly in C++ but there are a few differences
that cause some valid C code to be invalid or behave
differently in C++.
61
For example, C allows implicit conversion from void* to
other pointer types but C++ does not (for type safety
reasons).
Also, C++ defines many new keywords, such as new and
class, which may be used as identifiers (for example,
variable names) in a C program.
Some incompatibilities have been removed by the 1999
revision of the C standard (C99), which now supports C++
features such as line comments (//) and declarations
mixed with code.
On the other hand, C99 introduced a number of new
features that C++ did not support that were incompatible
or redundant in C++, such as variable-length arrays, native
complex-number types (however, the std::complex class in
the C++ standard library provides similar functionality,
although not code-compatible), designated initializers,
compound literals, and the restrict keyword.
[91] Some of the C99-introduced features were included in
the subsequent version of the C++ standard, C++11 (out of
those which were not redundant).[92][93][94] However,
the C++11 standard introduces new incompatibilities, such
as disallowing assignment of a string literal to a character
pointer, which remains valid C.
To intermix C and C++ code, any function declaration or
definition that is to be called from/used both in C and C++
must be declared with C linkage by placing it within an
extern "C" {/*...*/} block. Such a function may not rely on

62
features depending on name mangling (i.e., function
overloading).
 Criticism
Despite its widespread adoption, some notable
programmers have criticized the C++ language, including
Linus Torvalds,[95] Richard Stallman,[96] Joshua Bloch,
Ken Thompson[97][98][99] and Donald Knuth.[100][101]
One of the most often criticised points of C++ is its
perceived complexity as a language, with the criticism that
a large number of non-orthogonal features in practice
necessitates restricting code to a subset of C++, thus
eschewing the readability benefits of common style and
idioms. As expressed by Joshua Bloch:
I think C++ was pushed well beyond its complexity
threshold, and yet there are a lot of people programming
it. But what you do is you force people to subset it. So
almost every shop that I know of that uses C++ says, "Yes,
we're using C++ but we're not doing multiple-
implementation inheritance and we're not using operator
overloading.”
There are just a bunch of features that you're not going to
use because the complexity of the resulting code is too
high. And I don't think it's good when you have to start
doing that.
You lose this programmer portability where everyone can
read everyone else's code, which I think is such a good
thing.

63
Donald Knuth (1993, commenting on pre-standardized
C++), who said of Edsger Dijkstra that "to think of
programming in C++" "would make him physically
ill":[100][101]
The problem that I have with them today is that... C++ is
too complicated. At the moment, it's impossible for me to
write portable code that I believe would work on lots of
different systems, unless I avoid all exotic features.
Whenever the C++ language designers had two competing
ideas as to how they should solve some problem, they said
"OK, we'll do them both".
So the language is too baroque for my taste.

64
Why c++ is so popular?
The programming language known as C++ (or “C-plus-
plus”) is a general purpose coding language which has
been used for game programming, software engineering,
data structures, developing browsers, operating systems,
applications, and more for over forty years.
Developed by Bjarne Stroustrup in 1979, it supports
procedural, object-oriented programming and functional
programming, and was created as an extension to C
language -- to which it is still easy to integrate.
Because of this, it gives programmers a high level of
control over system resources and memory, and is the
basis of millions of existing programs and lines of code.
But with so many other programming languages
developed since 1979 -- from Java to C# -- why is the C++
programming language still in use? And why do some
developers even prefer it over newer, shiner, and more
popular languages?
In this article, we’ll break down some of those reasons,
defining what makes C++ still relevant today -- and why
it’s a unique tool in any developer's toolkit.
 It’s history
C++ has been around for over 40 years which means, sure,
it’s old.
But it also means it’s been around for 40+ years -- and 40+
years means 40+ years worth of developers spending
65
hundreds of thousands of hours building out libraries for
its use, perfecting its methodology, developing test cases,
and refining it into the best version of itself.
From a dev’s perspective, and in terms of computer
science work, it also means there are millions of programs
out there already written in C++, so even if nothing new
was ever written in C++ there’d still be a whole lot of work
required just in keeping what exists going strong!
For that reason, C++ is important because it’s old. Even if
its age may seem like a liability.

 2. It’s efficient
Let’s be clear: C++ wouldn’t be around today if it didn’t
work.
C++ is known as a “low-level” programming language --
meaning the language provides little (or no) abstraction
from the architecture the computer uses (1s and 0s), and
maintains similar structure to the processor's structure.
And in that sense, it maintains the simplicity and
directness of this “low-level” function.
As such, its performance and memory are efficient, as
there isn’t a lot of intermediary between the code you’re
writing and what it takes for the computer to understand
that code.
This means that C++ runs well and runs efficiently. That’s
part of the reason it's still in use, and why that use is
expanding and not contracting.
66
 3. It’s versatile
Unlike some programming languages, C++ has been able to
stay useful, current, and vital, because it has been able to
evolve as the needs for it have changed.
Unlike other languages, C++ is adaptable, and has adapted
quickly alongside programmer and software needs.
In addition, C++ is versatile because it’s been broadly used
for so long that it’s highly compatible with most other
languages on the market and for most emergent uses.
You can use C++ for infrastructure on the client side, or for
inter-processor and network communication. And more.

 4. It has jobs
With so much code written in C++ already, it’s no surprise
that there are plenty of jobs for devs who are proficient in
C++.
Top companies from Google to Microsoft often seek out
and hire C++ devs -- and Jobsity has a strong record of
placing the top 3% of LATAM C++ devs in jobs in
companies all over North America.
Whether it’s old or not, it’s still popular for building
android apps, video games, virtual reality, and highly-
reliable FinTech applications -- for this reason, it’s hosts a
very active job market and should not be overlooked by
devs and hiring managers who are building out strong
nearshore or in-house teams.

67
 5. It’s the back-bone of OS, Browser, Libraries, and
more
Regardless of what you’re building, if it’s user-facing, it’s
likely you’ll be building it for use with an Operating
System. That means it’ll need to integrate with C++.
Why? Because almost all of the world’s major operating
systems are built with C++, including Microsoft Windows,
Mac OS, and Linux.
So regardless of the many uses of C++, this use makes it
essential to understand.
And this is the same as with all of the world’s major web
browsers.
Their rendering engines are built in C++ because C++ is
fast and simple, and we want our browser to render as
quickly as possible (we’re impatient; let’s not pretend
otherwise).
For this reason (speed), many libraries also depend on C++
-- including some of the most widely used Machine
Learning libraries (like Tensorflow).
If a library requires high-performance computation,
involving the multiplications of huge matrices for Machine
Learning training, then the optimum speed of C++ is a
significant asset.
 6. Its community
Another significant benefit of C++’s age and maturity is
that it has a large community of users, and this community
of users -- spread around the world and in every corner of
68
the dev world, too -- supports C++ (and those writing in it)
with a plethora of support, both paid and open source.
Myriad online courses, code libraries, resource banks, and
open source communities exist online for C++, making it
the 6th most used and followed tag on StackOverflow and
GitHub.
That means it’s not only easier to use, but it’s easier to
learn. And for a new dev or an older one, that’s a huge
advantage.

At the end of the day, every programming project requires


serious decision making around what language to use and
why.
Deciding whether C++ is the best language for your project
is no casual matter.
Taking into account delivery speed, price, and quality, it
stands up pretty well to the competition -- though it’ll
matter what you are building and what your priorities are.
But you’d be naive to count C++ out just because it’s not
the newest language in the bunch.
And if the reasons above resonate with you and seem to
align with the needs of the program you’re developing, we
urge you to consider this versatile, fast, foundational, and
efficient language.
If you need help connecting with a great C++ dev, we’re
always here to help. We only work with the best!

69
If you want to stay up to date with all the new content we
publish on our blog, share your email and hit the subscribe
button.
Also, feel free to browse through the other sections of the
blog where you can find many other amazing articles on:
Programming, IT, Outsourcing, and even Management.

70
Abstract
The Project is developed for the threat free and user
oriented Online Voting System. The Online Voting system
is made for the people of the country residing around the
world and wants to vote for their representative. The
election can be conducted in two ways the paper ballot
election and the automated ballot elections.

The automated ballot elections are called the electronic


voting. The online voting system is highly developed and
the online polling system can be replaced by accurately
and directly voting online and immediate results. The
online voting system is done by the internet so it can be
called the Internet Voting.

The Existing System

The existing system is manual and the paper based voting


which is voted on paper and counted manually. The
electronic tabulation brings new kind of voting system in
which the electronic cards with all candidates symbol is
marked manually and this can be counted electronically.
The electronic voting systems are now different types
known as the punch card, mark sense and the digital pen
voting systems.

The Electronic Ballot Marker makes the voter more easy to


vote by providing the selections on the display to vote
present on the electronic machine.

71
The direct recording electronic voting machine is one
which provides the display that can be start when the
voter touches the display consists of the mechanical and
electro optical buttons, software that accepts the vote and
possesses a image or symbol on the display.

The electronic ballots are connected with the central


ballot systems which directly accept and get the updated
record of all ballots. The central ballot system applies the
Precinct count method which calculates the all votes from
the ballots present at polling centers. The results are
immediate.

The Proposed System

The online voting system is for the citizens from all


overIndiathat consists of the data and information

1. The database of the Voter’s information and details


2. Voter’s Id
3. Calculation of total votes
4. Checking information by the voter
5. Remove wrong information
6. The information immediately transfers to Election
Commission.

72
VOTING MANAGEMENT SYSTEM

This code is about calculating the number of voters for the


candidates using c++.C++ is a cross-platform language that
can be used to create high-performance applications. C++
was developed by Bjarne Stroustrup, as an extension to the
C language. C++ gives programmers a high level of control
over system resources and memory.

Advantages and Disadvantages

Many companies now offer online voting systems for


organizations to streamline their elections. And it doesn’t
end there!
You could be electing a new class president, choosing the
next CEO for your company, or voting on a crucial company
decision. An online voting system like we provide is an
excellent way to save time and money.
Yet there are some disadvantages to online voting. This
article will discuss both the pros and cons of the process.
These ideas will help you decide if you should implement
the system in your organization. We’ll also consider if you
can improve election security by implementing an online
voting system.

73
What Is An Online Voting System?
An online voting system is a platform that allows
organizational members to cast their votes electronically,
which can be through a website, mobile app, or any
internet-connected device.
You can conduct various types of elections through an
online voting system. For example, you can use it for a
simple majority vote, where the option or the candidate
with the most votes wins. You can also use it for a more
complex voting system like proportional representation,
where each vote holds weight according to the voter's
preference.
Everyday use cases for an online voting system include:
Board of directors elections
Shareholder meetings
Homeowners Association (HOA) board elections
Union leadership votes
Student government elections
A typical online voting session goes like this:
First, the voter logs in to the voting system using their
unique username and password.
Next, they select the candidates or options they want to
elect.
Finally, they submit their vote, and the system tallies the
results.

74
What Are The Advantages Of Online Voting Systems?

The advantages of online voting systems include increased


efficiency, improved accuracy, and greater voter
engagement compared to paper ballots.

Increased Efficiency
One of the most significant advantages of online voting
systems is incredible efficiency. With traditional paper-
based voting, there are a lot of steps involved, from
printing ballots to counting votes by hand. You can avoid
all of that with online voting.
With an online system, you can send out electronic ballots
to all of your voters in just a few clicks. And once the
voting period is over, the system will automatically tally
the results, so you don't have to do it yourself, saving your
organization a lot of time and money.

Improved Accuracy
Another advantage of online voting systems is that they
tend to be more accurate than traditional paper-based
systems. On the other hand, there's always the potential
for human error with paper ballots, whether it's
miscounting votes or mixing up ballots.

75
But with an online voting system, the votes are tallied
automatically, so there's no chance for human error, giving
you peace of mind knowing that your results are accurate.
Greater Turnout And Voter Engagement
Another advantage of online voting is that it can increase
voter turnout because it's more convenient for voters to
cast their ballots online than to have to go to a physical
polling place.
In addition, online elections can also improve voter
engagement. It can be easy for voters to feel disconnected
from the process of traditional voting. But with online
voting, they can see the results in real-time, making them
feel more engaged in the process.

What Are The Disadvantages Of Online Voting


Systems?
The two major concerns about online voting systems are
election security and transparency.

The Security Of Online Voting Systems


One of the most significant disadvantages of online voting
systems is that they're not as secure as traditional paper-
based systems because there's always the potential for
hackers to tamper with the results.

76
To improve election security, you should look for a system
that uses encryption to protect the data. The system must
get tested by independent security experts.
For example, we secure our online voting system using
256-bit encryption—the same level of security that major
banks offer. Plus, we don't share user and voter data,
which means your elections stay private and confidential.

Lack Of Transparency
Another disadvantage of online voting is that it can lack
transparency. With traditional paper-based voting, voters
can see people counting the ballots. But with online voting,
the process is entirely electronic, making it harder to
verify the results.
It’s essential to look for an online voting system that offers
transparency features. For example, some systems provide
a live election results page where voters can see the results
as they roll in.
Our voting system also offers election audit, which means
the votes cast using our system are auditable. We also
provide independent verification, where an independent,
third-party accountant ensures the election process is fair.

77
Final Thoughts
If you need to set up an election for your organization,
consider the advantages and disadvantages illustrated
above. What’s most important to you, efficiency, accuracy,
or transparency? Take time to think through these criteria
and decide if online elections are the right choice for you!

78
Coding

#include<iostream>
using namespace std;
int votes1=0, votes2=0,
votes3=0,votes4=0,votes5=0,votes6=0,votes7=0,votes8=0,
spoiltvotes=0;
int vote;

int main()

{
int i,n,age;
cout<<"Enter the number of voters"<<endl;
cin>>n;
for (i=1;i<=n ;i++ )
{
cout<<"enter your age"<<endl;
cin>>age;
if(age>=18)
{
cout<<"you are eligible for voting"<<endl;
cout<<"list of political parties in Tamil Nadu"<<endl;
79
cout<<"1.BMK"<<endl;
cout<<"2.IAADMK"<<endl;
cout<<"3.CMK"<<endl;
cout<<"4.DAMK"<<endl;
cout<<"5.DKDK"<<endl;
cout<<"6.AMKM"<<endl;
cout<<"7.NSK"<<endl;
cout<<"8.Others"<<endl;
cout<<"select your political party"<<endl;
}
else
{
cout<<"your not eligible for voting"<<endl;
}
if(age>18)
{
cout<<"\n Enter your vote:\t";
cin>>vote;
switch(vote)
{
case 1: votes1++;
break;

80
case 2:votes2++;
break;

case 3:votes3++;
break;

case 4:votes4++;
break;

case 5:votes5++;
break;

case 6:votes6++;
break;

case 7:votes7++;
break;

case 8:votes8++;
break;

81
default:spoiltvotes++;
}
}

}
cout<<"Number of votes for BMK:"<<votes1<<endl;
cout<<"Number of votes for IAADMK:"<<votes2<<endl;
cout<<"Number of votes for CMK:"<<votes3<<endl;
cout<<"Number of votes for DAMK:"<<votes4<<endl;
cout<<"Number of votes for DKDK:"<<votes5<<endl;
cout<<"Number of votes for AMKM:"<<votes6<<endl;
cout<<"Number of votes for NSK:"<<votes7<<endl;
cout<<"Number of votes for Others:"<<votes8<<endl;
cout<<"Number of spoilt votes"<< spoiltvotes;
return 0;
}

82
Output
Enter the number of voters
3
you are eligible for voting
list of political parties in Tamil Nadu
1.BMK
2.IAADMK
3.CMK
4.DAMK
5.DKDK
6.AMKM
7.NSK
8.Others
select your political party

Enter your vote:


enter your age
12
your not eligible for voting
enetr your age
19
you are eligible for voting
83
list of political parties in Tamil Nadu
1.BMK
2.IAADMK
3.CMK
4.DAMK
5.DKDK
6.AMKM
7.NSK
8.Others
select your political party

Enter your vote: 2


Number of votes for BMK:1
Number of votes for IAADMK:1
Number of votes for CMK:0
Number of votes for DAMK:0
Number of votes for DKDK:0
Number of votes for AMKM:0
Number of votes for NSK:0
Number of votes for Others:0
Number of spoilt votes:0

84
Screenshots

Code:

85
86
Output:

87
88
Explanation

In this program,we are going to find the number of votes


for the respective candidates..

votes1=0,votes2=0,votes3=0,votes4=0,votes5=0,votes6=0,
votes7=0,votes8=0,spoiltvotes=0;

Are declared as the outer scope.

Let n be the number of voters.

cin>>n-Inputs the number of voters.

For loop

i=1 — This step is used to initialize a variable and is


executed first and only once. Here, ’n’ is assigned a value 1.

i<=n — This is a condition which is evaluated. If the


condition is true, the statements written in the body of the
loop are executed. If it is false, the statement just after the
for loop is executed. This is similar to the condition we
used in ‘while’ loop which was being checked again and
again.

89
i++ — This is executed after the code in the body of the for
loop has been executed. In this example, the value of ’n’
increases by 1 every time the code in the body of for loop
executes. There can be any expression here which you
want to run after every loop.

IF STATEMENT

SYNTAX

If statement is used to check whether the voter is above


18+ or not.

Switch case

In switch…case, the value of the expression enclosed in the


brackets ( ) following switch is checked. If the value of the
expression matches the value of the number in case, the
statement(s) corresponding to that case will be executed.

90
In the program, the value of votes matches the number in
case.so,the votes1 got executed first and execute again and
again till the loop ends.

SYNTAX

91
Output explanation:

When n=3,Number of voters becomes 3 members. Next it


will check their age ,if their age is greater than or equal to
18. It will ask to enter the vote.If the age is lesser than 18.it
displays “You are not eligible for voting”.

Then it will start to count the votes using a switch case and
enter their respective results.

92
Conclusion
This approach allows for the easy development and
deployment of applications. For quit some time,voting
equipment vendors have maintained that their systems
are secure, and that tha closed-source nature makes them
even more secure

In fact, we believe that an open process would result in


more carefull development, as more scientists, software
engineers, political activists, and others who value theit
democracy would be paying attention to the quality of the
software that is used for their elections.

93
Reference
https://www.guvi.in/sign-in

https://electionbuddy.com/blog/2022/04/20/the-
advantages-and-disadvantages-of-online-voting-systems/

https://1000projects.org/online-voting-system-project-
abstract.html

https://www.oreilly.com/library/view/object-oriented-
programming/9789332503663/xhtml/head-
0045.xhtml#:~:text=C%2B%2B%20was%20developed%
20by%20Bjarne,it%20as%20C%2B%2B%20in%201983.

https://en.wikipedia.org/wiki/C%2B%2B

https://www.slideshare.net/Prabhukiran07/ptelectronic-
voting-machine

94

You might also like