Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

C++ Notes With Basic Introduction

Rating
-
Sold
-
Pages
6
Uploaded on
27-11-2024
Written in
2024/2025

Lecture notes of 6 pages for the course Bachelor of computer application at Bachelor of computer application (C++ notes.)

Institution
Course

Content preview

Introduction C++

C++ is an object oriented programming language. It was developed by Bjarne Stroustrup in 1979 at
Bell Laboratories in Murray Hill, New Jersey. He initially called the new language "C with Classes."
However, in 1983 the name was changed to C++. C++ is a superset of C. Stroustrup built C++ on the
foundation of C, including all of C’s features, attributes, and benefits. Most of the features that
Stroustrup added to C were designed to support object-oriented programming .These features
comprise of classes, inheritance, function overloading and operator overloading. C++ has many other
new features as well, including an improved approach to input/output (I/O) and a new way to write
comments.

C++ is used for developing applications such as editors, databases, personal file systems, networking
utilities, and communication programs. Because C++ shares C’s efficiency, much high-performance
systems software is constructed using C++.

A Simple C++ Program

#include<iostream.h>
#include<conio.h>
int main()
{
cout<< “Simple C++ program without using class”;
return 0;
}

Lines beginning with a hash sign (#) are directives read and interpreted by what is known as the pre-
processor. They are special lines interpreted before the compilation of the program itself begins. In
this case, the directive #include <iostream.h>, instructs the pre-processor to include a section of
standard C++ code, known as header iostream that allows to perform standard input and output
operations, such as writing the output of this program to the screen. The function named main is a
special function in all C++ programs; it is the function called when the program is run. The execution
of all C++ programs begins with the main function, regardless of where the function is actually
located within the code. The open brace ({) indicates the beginning of main's function definition, and
the closing brace (}) indicates its end. The statement: cout<< “Simple C++ program without using
class”; causes the string in quotation marks to be displayed on the screen. The identifier cout
(pronounced as c out) denotes an object. It points to the standard output device namely the console
monitor. The operator << is called insertion operator. It directs the string on its right to the object
on its left. The program ends with this statement: return 0; this causes zero to be returned to the
calling process (which is usually the operating system). Returning zero indicates that the program
terminated normally. Abnormal program termination should be signalled by returning a nonzero
value.
The general structure of C++ program with classes is shown as:
1. Documentation Section
2. Preprocessor Directives or Compiler Directives Section
(i) Link Section
(ii) Definition Section
3. Global Declaration Section
4. Class declaration or definition
5. Main C++ program function called main ( )

, C++ keywords
When a language is defined, one has to design a set of instructions to be used for communicating
with the computer to carry out specific operations. The set of instructions which are used in
programming, are called keywords. These are also known as reserved words of the language. They
have a specific meaning for the C++ compiler and should be used for giving specific instructions to
the computer. These words cannot be used for any other purpose, such as naming a variable. C++ is
a case-sensitive language, and it requires that all keywords be in lowercase. C++ keywords are:

auto break case char const continue default do


double else enum extern float for goto if


int long register return short signed sizeof static


struct switch typedef union unsigned void volatile while




Identifiers
An identifier is a name assigned to a function, variable, or any other user-defined item. Identifiers
can be from one to several characters long.
Rules for naming identifiers:
 Variable names can start with any letter of the alphabet or an underscore. Next comes a
letter, a digit, or an underscore.
 Uppercase and lowercase are distinct.
 C++ keywords cannot be used as identifier.


Data types
Data type defines size and type of values that a variable can store along with the set of operations
that can be performed on that variable. C++ provides built-in data types that correspond to integers,
characters, floating-point values, and Boolean values. There are the seven basic data types in C++ as
shown below:

Type Meaning

char(character) holds 8-bit ASCII characters

wchar_t(Wide character) holds characters that are part of large character sets

int(Integer) represent integer numbers having no fractional part

float(floating point) stores real numbers in the range of about 3.4x10–
38to 3.4x10 38,with a
precision of seven digits.
double(Double floating point) Stores real numbers in the range from 1.7x10 –308
to1.7x10308 with a precision of 15 digits.

bool(Boolean) can have only two possible values: true and false.

Void Valueless

Written for

Course

Document information

Uploaded on
November 27, 2024
Number of pages
6
Written in
2024/2025
Type
Class notes
Professor(s)
Abhijeet yadav
Contains
All classes

Subjects

$6.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
mrabhijeetcreationss

Get to know the seller

Seller avatar
mrabhijeetcreationss Future University
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions