Paradigms of Computer Programming and C++ Subject Code-CST-152
Paradigms of Computer Programming and C++ Subject Code-CST-152
and C++
Subject Code-CST-152
UNIT-I
Chapter-2
Topic Imperative Programming
When variables are declared of a particular data type then the variable
becomes the place where the data is stored and data types is the type of
value(data) stored by that variable.
FUNDAMENTAL DATA
TYPES
DATA TYPES
DERIVED DATA TYPES
INTEGER
CHARACTER
ARRAYS
FUNCTIONS
POINTERS
DERIVED DATA TYPES
REFERENCES
CONSTANTS
CLASS
STRUCTURE
USER DEFINED DERIVED DATA
TYPES
UNION
ENUMERATION
In most cases the standard input device is the keyboard. With the cin
and >> operators it is possible to read input from the keyboard.
example:
#include<iostream>
using namespace std;
int main()
{ char MY_CHAR;
cout << "Press a character and press return: ";
cin >> MY_CHAR;
cout << MY_CHAR;
return 0; }
University Institute of Engineering
27-04-2019 13
Namespace
Namespace is used to define a scope where identifiers like variables, functions,
classes, etc are declared. The main purpose of using a namespace is to prevent
ambiguity that may occur when two identifiers have same name
A namespace definition begins with the keyword namespace followed by the
namespace name as follows −
Syntax:
namespace namespace_name
{ // code declarations }
To call the namespace-enabled version of either function or variable, prepend (::)
the namespace name as follows −
name::code; // code could be variable or function.
This directive tells the compiler that the subsequent code is making
use of names in the specified namespace. The namespace is thus
implied for the following code −