100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Presentation C/C++ (Programming) CA$22.31   Add to cart

Presentation

Presentation C/C++ (Programming)

 3 views  0 purchase

Hey there! I’m linking my personally made c/c++ language codes in this file. This file contains plenty of codes and their descriptions which is easily understandable and does not involve any errors! Note!!! These codes are only for “embarcadero dev-c++ 6.3” and only supported on this softwa...

[Show more]

Preview 4 out of 68  pages

  • December 5, 2022
  • 68
  • 2022/2023
  • Presentation
  • Unknown
All documents for this subject (2)
avatar-seller
Yadwinder1234
; 20TH WEEK(1ST DAY)
What is C++?
C++ is an “object oriented” language created by Bjarne Stroustrup and released in 1985. It
implements “data abstraction” using a concept called “classes”, along with other features to
allow object oriented programming. C++ adds a concept called “operator overloading” not
seen in the earlier OOP languages & it makes the creation of libraries much cleaner.
C++ maintains aspect of the C programming language, yet has features whi9ch simplify
memory management.
C++ could be considered a superset of C.
C programs will run in C++ compiler.
C uses structured programming concepts & techniques while C++ uses object oriented
programming.

Features of C++ Language: -
C++ is an object oriented programming. The main features of C++ language are as follow:-

1. CLASSES:- The classes are user defined data types. A class is a collection of similar
type of data elements or objects.

2. DATA ABSTRACTION:- It means collection of data methods(functions). It refers the
act of representing essential features without including background details. It is also
known as abstracton data type (ADT).

3. DATA HIDING:- In C++ class construct allows to declare data & methods as a public,
private & protected group. The implementation details of a class can be hidden by data
hiding.

4. DATA ENCAPSULATION:- The internal data of a class are separated from outside
world. In other words, encapsulation groups all the pieces of an object into next package.

5. INHERITANCE:- It means the derivation of a class from a base class is called parent
class or basic & derived class is called child class. Inheritance is a property of class to
inherit the basic features of a class .

6. POLYMORPHISM:- Poly means more than one any operation & morphism means
forms. In OOPs a function or a name is used more than one.

7. DYNAMIC BINDING:- The binding refers to the linking of a procedure call to the
code to the executed in response to the call.

8. MESSAGE PASSING:- It is the another feature of OOPs. It consist of a set of objects
that communicate with each other.

,DIFFERENCE BETWEEN C & C++ LANGUAGE:

SR. C LANGUGAE C++ LANGUAGE
1. C is a procedural language. The o/p of one C++ is a object oriented language. It is
line become i/p to other. also called C with Classes.
2. C is a top down approach. C++ is a bottom up approach.

3. C doesn’t have property of polymorphism It includes the polymorphism

4. In C overloading of operators & functions In C++ overloading of operators &
are not possible. functions is possible.
5. It doesn’t support data abstraction, data It includes properties like data
hiding & data encapsulation. abstraction, data hiding & data
encapsulation.
6. C doesn’t include concepts of objects & C++ is purely on object based which
classes. have their own physical existence but
integrated together.
7. In it, printf() & scanf() used for input & In it, cin & cout used for input & output.
output.
8. It doesn’t have concept of inheritance It supports the concept of inheritance

9. It doesn’t have more & strong exception In it, exception handling is don eby the
handling extra
10. The header file for I/O is <stdio.h> The header file for I/O is <iostream>

11. C does not support friends, static methods, C++ provides friends, static methods,
constructors, destructors. constructors, destructors for the object.

VARIABLES:-
It is the name to given to memory location where some data or value is stored. In C++ language
variable must be declared before it can be used. Variables can declared at start of any block of
code. Values of the variables can be change during the execution of the program.

RULES FOR DECLARING VARIABLES:-
1. The name of the variable must be starting an alphabet.
2. The variable name should not have any space in between.
3. All the variable name must be separated by comma (,).
4. It should not be a keyword.
5. The length of variable name should not be normally more than 8 characters.
6. Upper and lower case matter in variable.
Example :- a=2;
B=5; C=a+b;

, KEYWORDS
Keywords are special words where meaning is already defined to the compiler. A valid identifier
is a sequence of one or more letters, digits or underscore characters(_) Keywords cannot be used
as variables or identifiers. Some keywords are the following:-
Break while Char continue
Default do Else float
Goto if Int return
Inline private Class delete
For friend Public protected


DATA TYPES:-
C++ language becomes powerful with the help of data types. Data types describe the type or
characteristics of variables or data.
SPECIFIC DATA TYPE VALUES:-

Data type Bytes of Range Value
memory

Int 2 -32768-32767 843

Float 4 -3.4e38-3.4e38 45.758

Char 1 -128-127 A

Bool 1 True or false 0 or 1


PROGRAM TO PRINT HELLO

#include<iostream>
using namespace std;
int main()
{
clrscr();
cout<<”hello”;
cout<<”welcome in c++”;
return 0;
}
PROGRAM TO SET FILL BLANK SPACES WITH DIFFERENT SYMBOLS

#include<iostream>
using namespace std;
int main()
{cout.fill(‘/’);
cout.width(20);
cout<<”wel”<<endl;

, cout.fill(‘_’);
cout.width(10);
cout<<”DONE”;
return 0;}
2nd DAY
PROGRAM TO ADD, SUBTRACT, MULTIPLY & DIVISION OF 2 NUMBERS

#include<iostream>
using namespace std;
int main()
{
int a,b,c,d,e,f;
clrscr();
cout<<”enter 2 numbers:-”;
cin>>a>>b;
C=a+b;
Cout<<”Addition is :-”<<c;
d=a-b;
cout<<”Subtraction is :-”<<d;
e=a*b;
cout<<”Multiplication is :-”<<e;
f=a/b;
cout<<”Division is :-”<<f;
return 0;
}

OPERATORS:-
Once we know of the existence of variables & constants, we can begin to operate with them. For
that purpose, C++ integrates operators. The operators makes C++ code shorter & more
international, since it relies less on English words, but requires a little of learning effort in the
beginning.
Following are the operators used in C++ language:-


OPERATOR NAME TYPES SYMBOL EXAMPLE

1. Addition + 2+1=3
2. Subtraction - 20-10=10
AIRTHMETIC 3. Multiplication * 5*4=20
OPERATORS 4. Division / 4/2=2
5. Modulo % 5%2=1

1. AND && x>y && x>z
LOGICAL OPERATOR 2. OR || a<b || b>c
3. NOT ! a==b ! a==c


ASSIGNMENT OPERATOR = a=5

1. INCREMENT ++ a++ / ++a

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Yadwinder1234. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for CA$22.31. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

72042 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
CA$22.31
  • (0)
  Add to cart