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

BCA study note

Rating
-
Sold
-
Pages
11
Uploaded on
15-08-2022
Written in
2022/2023

review of C++ programming

Institution
Course

Content preview

1



Review of C++ Programming
.



1. What are token? What are different types of tokens used in C++?

Tokens are the basic building blocks of a C++ program. There are five types of tokens in
C++.
1. Key words: Key words are tokens that carry a specific meaning to the language
compiler. Eg. int, switch etc..

2. Identifiers: Identifiers are user defined words that are used to name different program
elements such as memory locations, statements, functions, classes etc.
Identifiers used for naming memory location is known as variables.
Identifiers assigned to statements are known as labels.
Identifiers used for set of statements are known as functions.

3. Literal : Literals are data items that never change their values during the program
running. They are also known as constants. There are 4 types of literals
a) Integer literal: tokens formed only by digits. It must have at least one
digit and must not have decimal point. It may contain +ve or _ve sign as
first character
Eg. 15, -20, +40
b) Floating Point Literal (Real constants): They have fractional part. They
can be written in two forms: Fractional and exponential form.
They have at least one digit and a decimal point. They have either +ve or
–ve sign. In exponential form, there are two parts, Mantissa (Parts
appearing before E) and Exponential(Power).
Eg: 52.15, -715.12, .458E04

c) Character Literal : Single character enclosed with single quotes and that
never changes its value during program run. Non graphical symbols can be
represented by using escape sequence which consists of a back slash(\)
followed by one or more characters. (eg. \n, \a)
Eg. Valid Character Literal: ‘s’, ‘$’,’\n’
Invalid Character Literal: ‘82’, “k”, ‘\8’

, 2


d). String Literals: Sequence of one or more characters enclosed within a
pair of double quotes.
Eg. “computer”. Every string in C++ terminated by a null (\o) character.
4. Punctuators: Special symbols that have syntactic or semantic meaning to the
compiler.
Eg: #, : , ’ , ” ,() ,[]

5. Operators: Operators are the tokens that trigger some kind of operations. The
operations applied on a set of data called operands.
Based on the number of operands, operators are classified into three, Unary operator,
Binary operator and Ternary operator.

A unary operator acts on a single operand. A binary operator acts on two operands. A
ternary operator(? :) acts on three operands.

Based on the nature of operation operators are classified into three Arithmetic,
Relational and Logical operator.

a). Arithmetic operator are used for addition, subtraction, multiplication and division(+,
- , * , / ).
C++ provides a special operator modulus operator(%) for getting remainder of division
operation. For example 10 % 2 returns 0.

b) Relational operators
Relational operators are used to compare values. They produces only ‘True’ of
‘False’ values. The following are the relational operators in C++. c). Logical operator
Logical operators allows us to combine two or more conditions. They are often
referred to as Boolean operators. The logical operators are &&(logical AND),||(logical
OR),and !(logical NOT).

There are some other operators such
as, d). Input-Output operators
The Input-Output operators are used to take input and display output. The
operator(>>) is used for taking input, and the operator(<<) is used to display the output.
The >> operator is called extraction or get from operator. The operator << is called
insertion or put to operator. These are binary operators.

Written for

Institution
Course

Document information

Uploaded on
August 15, 2022
Number of pages
11
Written in
2022/2023
Type
Class notes
Professor(s)
Unknown
Contains
All classes

Subjects

$8.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
rinshana

Get to know the seller

Seller avatar
rinshana University of Calicut
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
0
Documents
4
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