Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Overig

Introduction and Basic concepts of C++ Programming

Beoordeling
-
Verkocht
-
Pagina's
34
Geüpload op
19-11-2023
Geschreven in
2023/2024

This document is about the Introduction to C++ Programming Language. It consists of C++ Data types and C++ Tokens, which includes Keywords, Identifiers, and Operators. Along with the theory part, there many examples to understand the concept and few exercises for practice.

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

INTRODUCTION TO C++

You may know that C++ is an extension to C Programming language. It was
developed at AT&T Bell Laboratories in the early 1980s by Bjarne Stroustrup. It is a
deviation from traditional procedural languages in the sense that it follows Object Oriented
Programming (OOP) approach which is quite suitable for managing large and complex
programs.

OBJECTIVES

After reading this lesson, you will be able to:

 learn about C++ character set, tokens and basic data types;
 explain the utility of different types of operators used in C++;
 identify the difference between implicit and explicit conversions;
 explain about Input/Output streams supported by C++;
 Explain the structure of a C++ program;
 write a simple program in C++.

C++ CHARACTER SET

Character set is a set of valid characters that a language can recognize. Acharacter
represents any letter, digit or any other special character. The C++programming language also
has some character set. Now let us learn C++language character set.

C++ character set




BASIC DATA TYPES

Now you will learn about basic data types used in C++ language. Every program specifies a
set of operations to be done on some data in a particular sequence. However, the data can be
of many types such as a number, a character, Boolean value etc. C++ supports a large number

,of data types. The built in or basic data types supported by C++ are integer, floating point and
character type. A brief discussion on these types is given below:




Data types with range

Integer type (int)

An integer is an integral whole number without a decimal point. These numbersare used for
counting. For example, 26, 373, –1729 are valid integers.Normally an integer can hold
numbers from –32768 to 32767. However, if theneed be, a long integer (long int) can also be
used to hold integers from–2, 147, 483, 648 to 2, 147, 483, 648.

Floating point type (float)

A floating-point number has a decimal point. Even if it has an integral value,it must include a
decimal point at the end. These numbers are used for measuringquantities.

Examples of valid floating-point numbers are: 27.4, -927., 40.03

A float type data can be used to hold numbers from 3.4*10–38 to 3.4*10 +38 withsix or
seven digits of precision. However, for more precision a double precisiontype (double) can be
used to hold numbers from 1.7*10–308 to 1.7*10+308 withabout 15 digits of precision.

Character Type (Char)

It is a non-numeric data type consisting of single alphanumeric character.

Examples of valid character types are: ‘A’, ‘9’, ‘P’, ‘8’, ‘&’.

It may be noted here that 9 and ‘9’ are of different data types. The former is

of type int and later of type char.

,TOKENS

A token is a group of characters that logically belong together. The programmercan write a
program by using tokens. C++ uses the following types of tokens.

 Keywords
 Identifiers
 Literals
 Punctuators
 Operators

Keywords

There are some reserved words in C++ which have predefined meaning to

complier called keywords. Some commonly used keywords are given below:

List of Keywords




Identifiers

Symbolic names can be used in C++ for various data items used by a programmerin his/her
program. For example, if you want to store a value 50 in a memorylocation, you can choose
any symbolic name (say MARKS) and use it as givenbelow:

MARKS = 50

The symbol ‘=’ is an assignment operator. The significance of the abovestatement is that
‘MARKS’ is a symbolic name for a memory location wherethe value 50 is being stored.A

, symbolic name is generally known as an identifier. The identifier is a sequenceof characters
taken from C++ character set. The rules for the formation of anidentifier are:

(i) An identifier can consist of alphabets, digits and/or underscores.

(ii) It must not start with a digit.

(iii) C++ is case sensitive, i.e., upper case and lower-case letters are considereddifferent from
each other. It may be noted that TOTAL and total are twodifferent identifier names.

(iv) It should not be a reserved word (keywords).

Literals

Literals (often referred to as constants) are data items that never change theirvalue during the
execution of the program. The following types of literals areavailable in C++.

(i) integer-constants

(ii) character-constants

(iii) floating-constants

(iv) string-literals

Integer constants

Integer constants are whole numbers without any fractional part. It may containeither + or –
sign, but decimal point or commas does not appear in any integerconstant. C++ allows three
types of integer constants.

1. decimal (Base 10)

2. octal (Base 8)

3. hexadecimal (Base 16)

Geschreven voor

Instelling
Vak
Onbekend

Documentinformatie

Geüpload op
19 november 2023
Aantal pagina's
34
Geschreven in
2023/2024
Type
OVERIG
Persoon
Onbekend

Onderwerpen

€8,38
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
wafa2335

Maak kennis met de verkoper

Seller avatar
wafa2335 Holy Cross College
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
2 jaar
Aantal volgers
0
Documenten
1
Laatst verkocht
-

0,0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen