SlideShare uma empresa Scribd logo
1 de 16
Comparison of C++ and C#
Prepared by
Sudip Vora
Topics
• Difference between C# and C++.
• Which is better in performance?
• Explain with an algorithm, program and prove
it.
Contents
• Introduction
• Difference between C++ and C#
• Example of C++
• Example of C#
• Algorithm and Program of C++
• Algorithm and Program of C#
• Conclusion
Introduction
• C++ is an object – Oriented programming language. It was
developed by Bjarne Stroustrup at AT & T Bell
Laboratories in Murray Hill, New Jersey, USA, I the early
of 1980s. Stroustrup, an admirer of simula67 and strong
supporter of C, wanted to combine the best of both the
languages and create a more powerful language that could
support object-oriented programming features and still retain
the power and elegance of C. The result was C++.
• Therefore, C++ is an extension of C with a major addition of
the class construct feature of simula67. Since the class was a
major addition to the original C language Stroustrup initially
called the new language ‘C with classes’. However, later in
1983, the name was changed to C++. The idea of C++ comes
from the C Increment operator ++, thereby suggesting that
C++ is an augmented – incremented version of C.
Introduction(Contd.)
• C# (pronounced see sharp) is a multi-paradigm
programming language encompassing strong
typing, imperative, declarative, functional,
generic, object-oriented (class-based), and
component-oriented programming disciplines. It
was developed by Microsoft within its .NET
initiative.
• The name "C sharp" was inspired by musical
notation where a sharp indicates that the written
note should be made a semitone higher in pitch.
Principles of C++ development
• It should be "simple, object-oriented
and familiar"
• It should be "robust and secure"
• It should be "architecture-neutral and
portable"
• It should execute with "high
performance"
• It should be "interpreted and dynamic "
Principles of C# development
• It should be simple, modern, general-purpose, object-oriented
programming language.
• The language, and implementations should provide support for
software engineering principles
• The language is intended for use in developing software
components suitable for deployment in distributed
environments.
• C# is intended to be suitable for writing applications for both
hosted and embedded systems, ranging from the very large
that use sophisticated operating systems, down to the very
small having dedicated functions.
• Robustness, durability and programmer productivity are
important.
Difference between C++ & C#
C++ C#
C++ compiles down to machine code. C# 'compiles' down to CLR, which ASP.NET
interprets (roughly) Edit - As pointed out
in comments, it JIT compiles, not
interprets.
In C++, you must handle memory
manually.
Because C# runs in a virtual machine,
memory management is handled
automatically.
C++ support the multiple inheritance (of
implementation).
C# does not (although it does have
multiple inheritance of interface).
C++ includes a very powerful—and more
complex and difficult to master—
template meta language.
C# originally had nothing like it, with
many people believing that the common
type hierarchy obviated the need for
such techniques.
In C++ you have to do your own memory
management.
C# has a garbage collector.
Difference between C++ & C#(Contd.)
C++ C#
Pointers can be used anywhere in C++. In C# pointers are used only in unsafe
mode.
Default access Specifier is Public in C++. Default access Specifier is Private in
C#.net.
C++ is OOPS based. C# is Component & OOPS Based.
C++ is a language that runs on all sorts of
platforms, being extremely popular on
Unix and Unix-like systems.
C#, while standardized, is rarely seen
outside Windows.
C++ can create stand alone applications C# cannot.
C++ can create only console applications. C# can create console applications,
Windows applications, and ASP.NET
Websites,Mobile Applications,etc.
Example of C++
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
cout<<"n HELLO WORLD";
getch();
}
Example of C#
using System;
class Program
{
static void Main()
{
Console.WriteLine("Hello world!");
}
}
Algorithm to calculate Area of a Rectangle
Steps Description
1 Start
2 Ask the user for length and width of side
3 Store the value in box Length and Width
4 Calculate the area of the square (Length x Width)
5 Store the area in box Area
6 Print the value in box Area, appropriately labeled
7 Stop
Program of the above algorithm in C++
// Demonstration of variables
#include <iostream.h>
int main()
{
unsigned short int Width = 5, Length;
Length = 10;
// create an unsigned short and initialize with result
// of multiplying Width by Length
unsigned short int Area = Width * Length;
cout << "Width:" << Width << "n";
cout << "Length: " << Length << endl;
cout << "Area: " << Area << endl;
return 0;
}
Algorithm to calculate Area of a Rectangle
Steps Description
1 Start
2 Ask the user for length and width of side
3 Store the value in box Length and Width
4 Calculate the area of the square (Length x Width)
5 Store the area in box Area
6 Print the value in box Area, appropriately labeled
7 Stop
Program of the above algorithm in C#
using System;
class Program
{
static void Main(string[] args)
{
double Length;
double Area;
Console.WriteLine("Enter the length of a side of
Square :");
Length = Convert.ToDouble(Console.ReadLine());
Area = Length * Length;
Console.WriteLine("The area of Square is: " + Area);
Console.ReadLine();
}
}
Conclusion
• After going through various aspects of both, C++ and C#, we
came to a point that we claim that C# is better than C++. C#
has the features which C++ hadn’t.
• C# has many features that overcome the features of C++
which are not at all present in C++. Hence, we conclude with
C# is better than C++ in performance, usability and durability.

Mais conteúdo relacionado

Mais procurados

CSharp Presentation
CSharp PresentationCSharp Presentation
CSharp PresentationVishwa Mohan
 
Dotnet Basics Presentation
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics PresentationSudhakar Sharma
 
Architecture of net framework
Architecture of net frameworkArchitecture of net framework
Architecture of net frameworkumesh patil
 
.NET and C# introduction
.NET and C# introduction.NET and C# introduction
.NET and C# introductionPeter Gfader
 
C# programming language
C# programming languageC# programming language
C# programming languageswarnapatil
 
Introduction to .net framework
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net frameworkArun Prasad
 
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaCPD INDIA
 
.NET and C# Introduction
.NET and C# Introduction.NET and C# Introduction
.NET and C# IntroductionSiraj Memon
 
Introduction To Dotnet
Introduction To DotnetIntroduction To Dotnet
Introduction To DotnetSAMIR BHOGAYTA
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVAAbhilash Nair
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#Doncho Minkov
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial Jm Ramos
 
C++ Programming Course
C++ Programming CourseC++ Programming Course
C++ Programming CourseDennis Chang
 

Mais procurados (20)

CSharp Presentation
CSharp PresentationCSharp Presentation
CSharp Presentation
 
C#.NET
C#.NETC#.NET
C#.NET
 
Dotnet Basics Presentation
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics Presentation
 
Architecture of net framework
Architecture of net frameworkArchitecture of net framework
Architecture of net framework
 
Object model
Object modelObject model
Object model
 
.NET and C# introduction
.NET and C# introduction.NET and C# introduction
.NET and C# introduction
 
C# programming language
C# programming languageC# programming language
C# programming language
 
Introduction to .NET Framework
Introduction to .NET FrameworkIntroduction to .NET Framework
Introduction to .NET Framework
 
Object-oriented concepts
Object-oriented conceptsObject-oriented concepts
Object-oriented concepts
 
Introduction to .net framework
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net framework
 
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in java
 
.NET and C# Introduction
.NET and C# Introduction.NET and C# Introduction
.NET and C# Introduction
 
Introduction To Dotnet
Introduction To DotnetIntroduction To Dotnet
Introduction To Dotnet
 
.Net
.Net.Net
.Net
 
Oop java
Oop javaOop java
Oop java
 
C# language
C# languageC# language
C# language
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
 
C++ Programming Course
C++ Programming CourseC++ Programming Course
C++ Programming Course
 

Destaque

difference between c c++ c#
difference between c c++ c#difference between c c++ c#
difference between c c++ c#Sireesh K
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#Sagar Pednekar
 
C# for C++ Programmers
C# for C++ ProgrammersC# for C++ Programmers
C# for C++ Programmersrussellgmorley
 
Difference between C++ and Java
Difference between C++ and JavaDifference between C++ and Java
Difference between C++ and JavaAjmal Ak
 
Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)jeffz
 
Difference between java and c#
Difference between java and c#Difference between java and c#
Difference between java and c#TECOS
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaSteve Fort
 
Computer science presentation
Computer science presentationComputer science presentation
Computer science presentationdehrabf
 
Evolution of c# - by K.Jegan
Evolution of c# - by K.JeganEvolution of c# - by K.Jegan
Evolution of c# - by K.Jegantalenttransform
 
Report on GPU complex type usage
Report on GPU complex type usageReport on GPU complex type usage
Report on GPU complex type usageCaner Candan
 
Corrosion control
Corrosion controlCorrosion control
Corrosion controlZTE Nepal
 
A Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application FrameworkA Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application FrameworkZachary Blair
 

Destaque (20)

Ppt of c++ vs c#
Ppt of c++ vs c#Ppt of c++ vs c#
Ppt of c++ vs c#
 
Differences between c and c++
Differences between c and c++Differences between c and c++
Differences between c and c++
 
difference between c c++ c#
difference between c c++ c#difference between c c++ c#
difference between c c++ c#
 
Difference between Java and c#
Difference between Java and c#Difference between Java and c#
Difference between Java and c#
 
C vs c++
C vs c++C vs c++
C vs c++
 
C# for C++ Programmers
C# for C++ ProgrammersC# for C++ Programmers
C# for C++ Programmers
 
C vs c++
C vs c++C vs c++
C vs c++
 
Difference between C++ and Java
Difference between C++ and JavaDifference between C++ and Java
Difference between C++ and Java
 
C++vs java
C++vs javaC++vs java
C++vs java
 
C# basics
 C# basics C# basics
C# basics
 
Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)
 
Ppt of c vs c#
Ppt of c vs c#Ppt of c vs c#
Ppt of c vs c#
 
Difference between java and c#
Difference between java and c#Difference between java and c#
Difference between java and c#
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Computer science presentation
Computer science presentationComputer science presentation
Computer science presentation
 
Evolution of c# - by K.Jegan
Evolution of c# - by K.JeganEvolution of c# - by K.Jegan
Evolution of c# - by K.Jegan
 
openFrameworks
openFrameworksopenFrameworks
openFrameworks
 
Report on GPU complex type usage
Report on GPU complex type usageReport on GPU complex type usage
Report on GPU complex type usage
 
Corrosion control
Corrosion controlCorrosion control
Corrosion control
 
A Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application FrameworkA Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application Framework
 

Semelhante a C++ vs C#

Object oriented programming 7 first steps in oop using c++
Object oriented programming 7 first steps in oop using  c++Object oriented programming 7 first steps in oop using  c++
Object oriented programming 7 first steps in oop using c++Vaibhav Khanna
 
Summer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptxSummer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptxshokeenk14
 
object oriented programming language fundamentals
object oriented programming language fundamentalsobject oriented programming language fundamentals
object oriented programming language fundamentalsChaithraCSHirematt
 
Object oriented programming c++
Object oriented programming c++Object oriented programming c++
Object oriented programming c++Ankur Pandey
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionAKR Education
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfAnassElHousni
 
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREC & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREjatin batra
 
C programming orientation
C programming orientationC programming orientation
C programming orientationnikshaikh786
 
C# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net FrameworkC# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net FrameworkDr.Neeraj Kumar Pandey
 
C++ language basic
C++ language basicC++ language basic
C++ language basicWaqar Younis
 
Comparison of c++ and c#
Comparison of c++ and c#Comparison of c++ and c#
Comparison of c++ and c#fahad javed
 
Event Driven Programming in C#.docx
Event Driven Programming in C#.docxEvent Driven Programming in C#.docx
Event Driven Programming in C#.docxLenchoMamudeBaro
 
Basics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxBasics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxCoolGamer16
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++Manoj Kumar
 

Semelhante a C++ vs C# (20)

Object oriented programming 7 first steps in oop using c++
Object oriented programming 7 first steps in oop using  c++Object oriented programming 7 first steps in oop using  c++
Object oriented programming 7 first steps in oop using c++
 
Summer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptxSummer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptx
 
object oriented programming language fundamentals
object oriented programming language fundamentalsobject oriented programming language fundamentals
object oriented programming language fundamentals
 
Object oriented programming c++
Object oriented programming c++Object oriented programming c++
Object oriented programming c++
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introduction
 
C_Programming_Notes_ICE
C_Programming_Notes_ICEC_Programming_Notes_ICE
C_Programming_Notes_ICE
 
C-sharping.docx
C-sharping.docxC-sharping.docx
C-sharping.docx
 
Oops index
Oops indexOops index
Oops index
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
 
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREC & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
C programming orientation
C programming orientationC programming orientation
C programming orientation
 
C# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net FrameworkC# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net Framework
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
 
Comparison of c++ and c#
Comparison of c++ and c#Comparison of c++ and c#
Comparison of c++ and c#
 
Event Driven Programming in C#.docx
Event Driven Programming in C#.docxEvent Driven Programming in C#.docx
Event Driven Programming in C#.docx
 
Basics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxBasics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptx
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 

Último

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Último (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

C++ vs C#

  • 1. Comparison of C++ and C# Prepared by Sudip Vora
  • 2. Topics • Difference between C# and C++. • Which is better in performance? • Explain with an algorithm, program and prove it.
  • 3. Contents • Introduction • Difference between C++ and C# • Example of C++ • Example of C# • Algorithm and Program of C++ • Algorithm and Program of C# • Conclusion
  • 4. Introduction • C++ is an object – Oriented programming language. It was developed by Bjarne Stroustrup at AT & T Bell Laboratories in Murray Hill, New Jersey, USA, I the early of 1980s. Stroustrup, an admirer of simula67 and strong supporter of C, wanted to combine the best of both the languages and create a more powerful language that could support object-oriented programming features and still retain the power and elegance of C. The result was C++. • Therefore, C++ is an extension of C with a major addition of the class construct feature of simula67. Since the class was a major addition to the original C language Stroustrup initially called the new language ‘C with classes’. However, later in 1983, the name was changed to C++. The idea of C++ comes from the C Increment operator ++, thereby suggesting that C++ is an augmented – incremented version of C.
  • 5. Introduction(Contd.) • C# (pronounced see sharp) is a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines. It was developed by Microsoft within its .NET initiative. • The name "C sharp" was inspired by musical notation where a sharp indicates that the written note should be made a semitone higher in pitch.
  • 6. Principles of C++ development • It should be "simple, object-oriented and familiar" • It should be "robust and secure" • It should be "architecture-neutral and portable" • It should execute with "high performance" • It should be "interpreted and dynamic "
  • 7. Principles of C# development • It should be simple, modern, general-purpose, object-oriented programming language. • The language, and implementations should provide support for software engineering principles • The language is intended for use in developing software components suitable for deployment in distributed environments. • C# is intended to be suitable for writing applications for both hosted and embedded systems, ranging from the very large that use sophisticated operating systems, down to the very small having dedicated functions. • Robustness, durability and programmer productivity are important.
  • 8. Difference between C++ & C# C++ C# C++ compiles down to machine code. C# 'compiles' down to CLR, which ASP.NET interprets (roughly) Edit - As pointed out in comments, it JIT compiles, not interprets. In C++, you must handle memory manually. Because C# runs in a virtual machine, memory management is handled automatically. C++ support the multiple inheritance (of implementation). C# does not (although it does have multiple inheritance of interface). C++ includes a very powerful—and more complex and difficult to master— template meta language. C# originally had nothing like it, with many people believing that the common type hierarchy obviated the need for such techniques. In C++ you have to do your own memory management. C# has a garbage collector.
  • 9. Difference between C++ & C#(Contd.) C++ C# Pointers can be used anywhere in C++. In C# pointers are used only in unsafe mode. Default access Specifier is Public in C++. Default access Specifier is Private in C#.net. C++ is OOPS based. C# is Component & OOPS Based. C++ is a language that runs on all sorts of platforms, being extremely popular on Unix and Unix-like systems. C#, while standardized, is rarely seen outside Windows. C++ can create stand alone applications C# cannot. C++ can create only console applications. C# can create console applications, Windows applications, and ASP.NET Websites,Mobile Applications,etc.
  • 10. Example of C++ #include<iostream.h> #include<conio.h> void main() { clrscr(); cout<<"n HELLO WORLD"; getch(); }
  • 11. Example of C# using System; class Program { static void Main() { Console.WriteLine("Hello world!"); } }
  • 12. Algorithm to calculate Area of a Rectangle Steps Description 1 Start 2 Ask the user for length and width of side 3 Store the value in box Length and Width 4 Calculate the area of the square (Length x Width) 5 Store the area in box Area 6 Print the value in box Area, appropriately labeled 7 Stop
  • 13. Program of the above algorithm in C++ // Demonstration of variables #include <iostream.h> int main() { unsigned short int Width = 5, Length; Length = 10; // create an unsigned short and initialize with result // of multiplying Width by Length unsigned short int Area = Width * Length; cout << "Width:" << Width << "n"; cout << "Length: " << Length << endl; cout << "Area: " << Area << endl; return 0; }
  • 14. Algorithm to calculate Area of a Rectangle Steps Description 1 Start 2 Ask the user for length and width of side 3 Store the value in box Length and Width 4 Calculate the area of the square (Length x Width) 5 Store the area in box Area 6 Print the value in box Area, appropriately labeled 7 Stop
  • 15. Program of the above algorithm in C# using System; class Program { static void Main(string[] args) { double Length; double Area; Console.WriteLine("Enter the length of a side of Square :"); Length = Convert.ToDouble(Console.ReadLine()); Area = Length * Length; Console.WriteLine("The area of Square is: " + Area); Console.ReadLine(); } }
  • 16. Conclusion • After going through various aspects of both, C++ and C#, we came to a point that we claim that C# is better than C++. C# has the features which C++ hadn’t. • C# has many features that overcome the features of C++ which are not at all present in C++. Hence, we conclude with C# is better than C++ in performance, usability and durability.