You are on page 1of 50

COMPANY PROFILE

Viva Technologies welcomes you to the world of avant- grade and


ingenious internet technology. We are one of the forefronts IT company
in India, started as an amateur in 2003 in the capital city
Gwalior. Nevertheless, now we have established ourselves as a virtuoso
and seasoned professional in the field of Website Designing,
Developing, Internet Marketing and Industrial Training and Software
Development.

We own a team of seasoned and tailored professionals, who have


experience of long many years in their relevant work areas and are
regarded as best in their field. Thus, till now we have provided the state
of art solutions related with internet technology and declare to do the
same in future.

We have set this company in order to serve unblemished web solutions to


our potential customers, so that they can easily lay their path of success
using the magic and gigantic space of internet and become a part of their
forthcoming success.

We with our team strive to cater every kind of Web solutions to our
clientele, as they demand. We also ensure that whatever we provide them
should not only help them in accomplishing their goal, but also put their
efforts in right track.

Moreover, we also keep the utmost satisfaction of our precious customers


at top priority, since we believe in providing satisfactory and quality
work.

Today, when the whole world has been shrunk to a single internet, then it
has become more typical for a business to flourish without a proper and
recognized website. Thus, if anyone wants to earn more and more profits,
then he need to be known in this internet world, nevertheless the next
question arises how he can do so. For this, here comes Viva
Technologies in the picture. We provide the complete solution from
designing a website, developing it, domain booking, web hosting and
marketing it in such a way that everyone can easily get to know about it.
Thus, we provide the best IT services in India

VIVA of Technologies Gwalior is an ISO 9001:2008 Certified institute


Welcomes you to its digital world of IT and Computers VIVA
Technologies, Gwalior is India’s foremost Computer Education ,
Competitive Exams , Web Designing , CAD , Abacus Institute.
Founded as a training institute we have evolved into a leading IT and
IMS training institute. We recognized the rapidly changing IT landscape
in India and have innovated our teaching and courses over the years. We
at VIVA Institute, are committed to creating globally competent IT
professionals through our innovative teaching methods, advanced
courses, exceptional faculty and thought leadership in IT education. Our
training and best practices are bench marked along international lines. We
are grounded by the foundation and values of our past but are youthful
and progressive in our present and will continue in the future. All our
endeavors at VIVA Institute are to create opportunities for our students,
employees, business partners to lead a better life.

Page 2
INTRODUCTION

The project entitled as “Quizamania” is developed as a very


understandable Database of Questions that can be created and handled
easily It is similar to the quiz taken manually on paper that is now a days
waste of paper and time. Therefore in order to save the paper and time
and at the same time getting the properly database updated, it is created.

The Quiz goes like this, the user has to answer the question and if the user
is right he or she gains 10 points and if question attempt goes wrong the
right answer is displayed. There are 7 questions are set for first round. To
go to the next level user has to achieve atleast 60% marks.

Finally the result is stored in a file. There is a option in the project to find
the maximum score ,press the key ‘V’. It searches the maximum score
with the candidate name after comparing all the scores.

The project is developed using C++ and as a back-end we


have used File, So the storage of data for different modules are easy and
viewing the data can be done in the forms organized in the file.

Page 3
SOFTWARE REQUIREMENT SPECIFICATION

HARDWARE SPECIFICATION

Processor Intel Pentium I 2.66 GHz


Main Memory 4 KB
Hard Disk Capacity 4 MB
Keyboard 101 Keys
Monitor VGA with resolution
Printer Dot Matrix Printer

SOFTWARE CONFIGURATION

Operating System Windows XP


Language C++
Back End File

PREPOSED TECHNOLOGY

Page 4
THE ORIGIN OF C++

In 1979, a young engineer at Bell (now AT&T) Labs, Bjarne Stroustrup, started to
experiment with extensions to C to make it a better tool for implementing large-scale
projects. In those days, an average project consisted of tens of thousands of lines of
code (LOC).

In 1983, several modifications and extensions had already been made to C with
classes. In that year, the name "C++" was coined. Ever since then, the ++ suffix has
become a synonym for object-orientation. (Bjarne Stroustrup could have made a
fortune only by registering ++ as a trademark) It was also in that year that C++ was
first used outside AT&T Labs. The number of users was doubling every few months -
- and so was the number of compilers and extensions to the language.

Between 1985 and 1989, C++ underwent a major reform. Protected members,
protected inheritance, templates, and a somewhat controversial feature called multiple
inheritance were added to the language. It was clear that C++ needed to become
standardized.

BASIC INPUT/OUTPUT FUNCTIONS

CIN>>: It is used for input like scanf( ) in C.”>>” This is called insertors.

COUT<<: It is used for output like printf( ) in C.”<<” This is called exertors.

KEYWORDS

OBJECT ORIENTED PROGRAMMING

Page 5
C++ can be said to be as C language with classes. In C++ everything revolves around
object of class, which have their methods & data members.

For Example : We consider human body as a class, we do have multiple objects of


this class, with variable as color, hair etc. and methods as walking, speaking etc.

Main features of object oriented programming are-

1. Objects
2. Classes
3. Data Abstraction
4. Encapsulation
5. Inheritance
6. Overloading/Polymorphism
7. Exception Handling

OBJECTS

Objects are the basic unit of OOP. They are instances of class, which have data
members and uses various member functions to perform tasks.

Page 6
CLASS

It is similar to structures in C language. Class can also be defined as user defined


data type but it also contains functions in it. So, class is basically a blueprint for
object. It declare & defines what data variables the object will have and what
operations can be performed on the class's object.

ABSTRACTION

Abstraction refers to showing only the essential features of the application and hiding
the details. In C++, classes provide methods to the outside world to access & use the
data variables, but the variables are hidden from direct access.

ENCAPSULATION

It can also be said data binding. Encapsulation is all about binding the data variables
and functions together in class.

INHERITANCE

Inheritance is a way to reuse once written code again and again. The class which is
inherited is called base calls & the class which inherits is called derived class. So
when, a derived class inherits a base class, the derived class can use all the functions
which are defined in base class, hence making code reusable.

POLYMORPHISM

Polymorphion makes the code more readable. It is a features, which lets is create
functions with same name but different arguments, which will perform differently.
That is function with same name, functioning in different

OVERLOADING

Overloading is a part of polymorphion. Where a function or operator is made &


defined many times, to perform different functions they are said to be overloaded.

EXCEPTION HANDLING

Exception handling is a feature of OOP, to handle unresolved exceptions or errors


produced at runtime.

DATA TYPES
There are following data types:

Page 7
Type Keyword

Boolean bool

Character char

Integer int

Floating point float

Double floating point double

Valueless void

Wide character wchar_t

Several of the basic types can be modified using one or more of these type modifiers:
 signed
 unsigned
 short
 long
The following table shows the variable type, how much memory it takes to store the value in memory, and what is
maximum and minimum value which can be stored in such type of variables.

Type Typical Bit Width Typical Range

Char 1byte -127 to 127 or 0 to 255

unsigned char 1byte 0 to 255

signed char 1byte -127 to 127

Int 4bytes -2147483648 to 2147483647

unsigned int 4bytes 0 to 4294967295

Page 8
signed int 4bytes -2147483648 to 2147483647

short int 2bytes -32768 to 32767

unsigned short int Range 0 to 65,535

signed short int Range -32768 to 32767

long int 4bytes -2,147,483,648 to 2,147,483,647

signed long int 4bytes same as long int

unsigned long int 4bytes 0 to 4,294,967,295

Float 4bytes +/- 3.4e +/- 38 (~7 digits)

Double 8bytes +/- 1.7e +/- 308 (~15 digits)

long double 8bytes +/- 1.7e +/- 308 (~15 digits)

wchar_t 2 or 4 bytes 1 wide character

SIZEOF( )- It tells about how much space is taken by a variable.

#include <iostream.h>
int main()
{ cout << "Size of char : " << sizeof(char) << endl;
cout << "Size of int : " << sizeof(int) << endl;
cout << "Size of short int : " << sizeof(short int) << endl;
cout << "Size of long int : " << sizeof(long int) << endl;
cout << "Size of float : " << sizeof(float) << endl;
cout << "Size of double : " << sizeof(double) << endl;
cout << "Size of wchar_t : " << sizeof(wchar_t) << endl;
return 0;
}

Page 9
TYPEDEF DECLARATIONS:
You can create a new name for an existing type using typedef. Following is the simple syntax to define
a new type using typedef:
typedef type newname;

For example, the following tells the compiler that feet is another name for int:
typedef int feet;

example:
feet distance;

ENUMERATED TYPES:
An enumerated type declares an optional type name and a set of zero or more identifiers that can be used as values
of the type. Each enumerator is a constant whose type is the enumeration. To create an enumeration requires the
use of the keyword enum. The general form of an enumeration type is:
enum enum-name { list of names } var-list;

Here, the enum-name is the enumeration's type name. The list of names is comma separated.
For example, the following code defines an enumeration of colors called colors and the variable c of type color.
Finally, c is assigned the value "blue".
enum color { red, green, blue } c;

c = blue;

By default, the value of the first name is 0, the second name has the value 1, the third has the value 2,
and so on. But you can give a name a specific value by adding an initializer. For example, in the
following enumeration, green will have the value 5.
enum color { red, green=5, blue };

Here, blue will have a value of 6 because each name will be one greater than the one that precedes it.

VARIABLES
Variable are used in C++, where we need storage for any value, which will change in program.
Variable can be declared in multiple ways each with different memory requirements and functioning.
Variable is the name of memory location allocated by the compiler depending upon the datatype of the
variable.

Page 10
BASIC TYPES OF VARIABLES

Each variable while declaration must be given a datatype, on which the memory
assigned to the variable depends. Following are the basic types of variables,

bool For variable to store boolean values( True or False )

char For variables to store character types.

int for variable with integral values

float and double are also types for variables with large and floating point values

DECLARATION AND INITIALIZATION

Variable must be declared before they are used. Usually it is preferred to declare them
at the starting of the program, but in C++ they can be declared in the middle of
program too, but must be done before using them.
Example :
int i; // declared but not initialized
char c;
int i, j, k; // Multiple declaration
Initialization means assigning value to an already declared variable,
int i; // declaration
i = 10; // initialization
Initialization and declaration can be done in one single step also,
int i=10; //initialization and declaration in same step
int i=10, j=11;
If a variable is declared and not initialized by default it will hold a garbage value.
Also, if a variable is once declared and if try to declare it again, we will get a compile
time error.

SCOPE OF VARIABLES

All the variables have their area of functioning, and out of that boundary they don't
hold their value, this boundary is called scope of the variable. For most of the cases its
between the curly braces,in which variable is declared that a variable exists, not
outside it. We will study the storage classes later, but as of now, we can broadly
divide variables into two main types,

1.Global Variables
2. Local variables

Page 11
GLOBAL VARIABLES

Global variables are those, which ar once declared and can be used throughout the
lifetime of the program by any class or any function. They must be declared outside
the main() function. If only declared, they can be assigned different values at different
time in program lifetime. But even if they are declared and initialized at the same time
outside the main() function, then also they can be assigned any value at any point in
the program.

Example : Only declared, not initialized

include <iostream>
int x; // Global variable declared
int main()
{ x=10; // Initialized once
cout <<"first value of x = "<< x;
x=20; // Initialized again
cout <<"Initialized again with value = "<< x;
}

LOCAL VARIABLES
Local variables are the variables which exist only between the curly braces, in
which its declared. Outside that they are unavailable and leads to compile time
error.
Example
int main( )
{ int i=10;
if(i<20) // if condition scope starts
{ int n=100; // Local variable declared and initialized
} // if condition scope ends
cout << n; // Compile time error, n not available here
}

OPERATORS
An operator is a symbol that tells the compiler to perform specific mathematical or logical

manipulations. C++ is rich in built-in operators and provides the following types of operators:

 Arithmetic Operators

 Relational Operators

 Logical Operators

 Bitwise Operators

 Assignment Operators

 Misc Operators


ARITHMETIC OPERATORS

Page 12
There are following arithmetic operators supported by C++ language:

Assume variable A holds 10 and variable B holds 20, then:

Operator Description Example

+ Adds two operands A + B will give 30

- Subtracts second operand from the first A - B will give -10

* Multiplies both operands A * B will give 200

/ Divides numerator by de-numerator B / A will give 2

Modulus Operator and remainder of


% B % A will give 0
after an integer division

Increment operator, increases integer


++ A++ will give 11
value by one

Decrement operator, decreases integer


-- A-- will give 9
value by one

RELATIONAL OPERATORS

There are following relational operators supported by C++ language


Assume variable A holds 10 and variable B holds 20, then:

Operator Description Example

Checks if the values of two operands


== are equal or not, if yes then condition (A == B) is not true.
becomes true.

Checks if the values of two operands


!= are equal or not, if values are not equal (A != B) is true.
then condition becomes true.

Page 13
Checks if the value of left operand is
> greater than the value of right operand, (A > B) is not true.
if yes then condition becomes true.

Checks if the value of left operand is


< less than the value of right operand, if (A < B) is true.
yes then condition becomes true.

Checks if the value of left operand is


greater than or equal to the value of
>= (A >= B) is not true.
right operand, if yes then condition
becomes true.

Checks if the value of left operand is


less than or equal to the value of right
<= (A <= B) is true.
operand, if yes then condition becomes
true.

LOGICAL OPERATORS
There are following logical operators supported by C++ language. Assume variable A holds 1 and

variable B holds 0, then:

Operator Description Example

Called Logical AND operator. If both


&& the operands are non-zero, then (A && B) is false.
condition becomes true.

Called Logical OR Operator. If any of


|| the two operands is non-zero, then (A || B) is true.
condition becomes true.

Called Logical NOT Operator. Use to


! !(A && B) is true.
reverses the logical state of its operand.
If a condition is true, then Logical

Page 14
NOT operator will make false.

BITWISE OPERATORS
Bitwise operator works on bits and perform bit-by-bit operation. The truth tables for &, |, and ^ are as

follows:

p Q p&q p|q p^q

0 0 0 0 0

0 1 0 1 1

1 1 1 1 0

1 0 0 1 1

Assume if A = 60; and B = 13; now in binary format they will be as


follows:
A = 0011 1100
B = 0000 1101
-----------------
A&B = 0000 1100
A|B = 0011 1101
A^B = 0011 0001
~A = 1100 0011

The Bitwise operators supported by C++ language are listed in the following table. Assume variable A
holds 60 and variable B holds 13, then:

Operator Description Example

Binary AND Operator copies a bit to (A & B) will give 12 which is 0000
&
the result if it exists in both operands. 1100

Binary OR Operator copies a bit if it


| (A | B) will give 61 which is 0011 1101
exists in either operand.

Binary XOR Operator copies the bit if (A ^ B) will give 49 which is 0011
^
it is set in one operand but not both. 0001

Page 15
Binary Ones Complement Operator is (~A ) will give -61 which is 1100 0011
~ unary and has the effect of 'flipping' in 2's complement form due to a signed
bits. binary number.

Binary Left Shift Operator. The left


operands value is moved left by the A << 2 will give 240 which is 1111
<<
number of bits specified by the right 0000
operand.

Binary Right Shift Operator. The left


operands value is moved right by the A >> 2 will give 15 which is 0000
>>
number of bits specified by the right 1111
operand.

ASSIGNMENT OPERATORS
There are following assignment operators supported by C++ language:

Operator Description Example

Simple assignment operator, Assigns


C = A + B will assign value of A + B
= values from right side operands to left
into C
side operand

Add AND assignment operator, It adds


+= right operand to the left operand and C += A is equivalent to C = C + A
assign the result to left operand

Subtract AND assignment operator, It


subtracts right operand from the left
-= C -= A is equivalent to C = C - A
operand and assign the result to left
operand

Multiply AND assignment operator, It


*= C *= A is equivalent to C = C * A
multiplies right operand with the left
operand and assign the result to left

Page 16
operand

Divide AND assignment operator, It


divides left operand with the right
/= C /= A is equivalent to C = C / A
operand and assign the result to left
operand

Modulus AND assignment operator, It


%= takes modulus using two operands and C %= A is equivalent to C = C % A
assign the result to left operand

<<= Left shift AND assignment operator C <<= 2 is same as C = C << 2

>>= Right shift AND assignment operator C >>= 2 is same as C = C >> 2

&= Bitwise AND assignment operator C &= 2 is same as C = C & 2

bitwise exclusive OR and assignment


^= C ^= 2 is same as C = C ^ 2
operator

bitwise inclusive OR and assignment


|= C |= 2 is same as C = C | 2
operator

MISC OPERATORS
There are few other operators supported by C++ Language.

Operator Description

sizeof operator returns the size of a variable. For example,


Sizeof
sizeof(a), where a is integer, will return 4.

Conditional operator. If Condition is true ? then it returns


Condition ? X : Y
value X : otherwise value Y

Comma operator causes a sequence of operations to be


, performed. The value of the entire comma expression is the
value of the last expression of the comma-separated list.

Page 17
Member operators are used to reference individual members of
. (dot) and -> (arrow)
classes, structures, and unions.

Casting operators convert one data type to another. For


Cast
example, int(2.2000) would return 2.

Pointer operator & returns the address of an variable. For


&
example &a; will give actual address of the variable.

Pointer operator * is pointer to a variable. For example *var;


*
will pointer to a variable var.

Comma Operator

The purpose of comma operator is to string together several expressions. The value of a comma-

separated list of expressions is the value of the right-most expression. Essentially, the comma's effect

is to cause a sequence of operations to be performed.

The values of the other expressions will be discarded. This means that the expression on the right side

will become the value of the entire comma-separated expression.

For example:

#include <iostream.h>
int main( )
{
int i, j;
j = 10;
i = (j++, j+100, 999+j);
cout << i;
return 0;
}

Page 18
BRANCHING/DECISION STATEMENTS

Statement Description

if statement An if statement consists of a boolean expression followed


by one or more statements.
An if statement can be followed by an optional else
if...else statement statement, which executes when the boolean expression is
false.

switch statement A switch statement allows a variable to be tested for


equality against a list of values.

nested if statements You can use one if or else if statement inside another if or
else if statement(s).

nested switch statements You can use one swicth statement inside another switch
statement(s).

IF-ELSE
#include <iostream.h>
void main ( )
{
int a;
cout<<”Enter a Number”;
cin>>a;
if( a < 20 )
{
cout << "a is less than 20;" << endl;
}
else
{
cout << "a is not less than 20;" << endl;
}
}

ELSE IF
#include <iostream.h>

Page 19
void main ( )
{
char grade;
cout<<”Enter Grade (A to F)”;
cin>>grade;
if(grade==’A’)
cout << "Excellent!" << endl;
else if(grade==’B’)
cout << "Good" << endl;
else if(grade==’C’)
cout << "Ok" << endl;
else
cout << "Invalid grade" << endl;
}

SWITCH-CASE
#include <iostream.h>
int main ( )
{
char grade;
cout<<”Enter Grade (A to F)”;
cin>>grade;
switch(grade)
{
case 'A' :
cout << "Excellent!" << endl;
break;
case 'B' :
cout << "Good" << endl;
break;
case 'C' :
cout << "Well done" << endl;
break;
case 'D' :
cout << "You passed" << endl;
break;
case 'F' :
cout << "Better try again" << endl;
break;

Page 20
default :
cout << "Invalid grade" << endl;
}
cout << "Your grade is " << grade << endl;
return 0;
}

NESTED IF
#include <iostream.h>
int main ( )
{
int a = 100;
int b = 200;
if( a == 100 )
{
if( b == 200 )
{
cout << "Value of a is 100 and b is 200" << endl;
}
}
else
{
cout << "Error ";
}
return 0;
}

LOOP
A loop statement allows us to execute a statement or group of statements multiple times.

Loop Type Description

while loop Repeats a statement or group of statements while a given


condition is true. It tests the condition before executing the

Page 21
loop body.

for loop Execute a sequence of statements multiple times and


abbreviates the code that manages the loop variable.

do...while loop Like a while statement, except that it tests the condition at the
end of the loop body

nested loops You can use one or more loop inside any another while, for or
do..while loop.

WHILE LOOP

while loop can be address as an entry control loop. It is completed in 3 steps.

1. Variable initialization.( e.g int x=0; )


2. condition( e.g while( x<=10) )
3. Variable increment or decrement ( x++ or x-- or x=x+2 )

Syntax :

variable initialization ;
while (condition)
{
statements ;
variable increment or decrement ;
}
Example:
#include <iostream.h>
void main ( )
{ int a = 10;
while( a < 20 )
{ cout << "value of a: " << a << endl;
a = a + 1;
}}

Page 22
CLASS

A Class is way to bind the data and its associated functions together. It allows the data
and functions to be hidden, if necessary, from external use. When defining a class, we
are creating a new abstract data type that can be treated like any other built-in data
type. The class declaration describes the type and scope of its members. The general
form of declaration is as follows:

Syntax:

Class class_name
{
Private:
variable declarations;
function declarations;
public:
variable declaration;
function declaration;
};

The class declaration is similar to struct declaration. The body of a classis enclosed
within braces and terminated by a semicolon. The class body contains the declaration
of variables and functions. These functions and variables are collectively known as
class members.

ASSESSORS

PRIVATE: The Class members that have been declared as private can be accessed
only within the class.

PUBLIC: The Class members that have been declared as public can be accessed
outside the class also.

PROTECTED : like private except that derived classes have access to them too. Try not to use this - it
can help performance but it breaks encapsulation.

Example:

#include<iostream.h>
class item
{
int number; // private by default
float cost;
public:
void getdata ( )
{
cout<<”Enter a number”;
cin>>number;
cout<<”Enter a cost;
cin>>cost;
}

void putdata( )
{

Page 23
cout<<”number:”<<number<<”\n”;
cout<<”cost:”<<cost<<”\n”;
}
};

OBJECT

Objects are the basic run time entity in an object-oriented system. They may represent
a person, a place, a bank account or any that the program has to handle. They may
also represent user defined data such as vectors, time, and lists.
When a program is executed, the object interacted by sending messages to one
another. Example:

class emp
{
char name;
float age;
public:
void getdata( )
{
cout<<”ENTER NAME:”;
cin>>name;
cout<<”ENTER AGE:”;
cin>>age;
}
void putdata( )
{
cout<<”NAME:”<<name;
cout<<”AGE:”<<age;
}
};
int main( )
{
emp e;
e.getdata( );
e.putdata( );
return 0;
}

CONSTRUCTORS

A constructor is used to initialize an object. A default constructor is one that can be


invoked without any arguments. If there is no user-declared constructor for a class,
and if the class does not contain const or reference data members, the
implementation implicitly declares a default constructor for it.

#include<iostream.h>
class demo
{
int m,n;
public:
demo( ) //constructor defined
{
m=20;

Page 24
n=30;
}
void display( )
{
cout<<”m=”<<m<<”\n”;
cout<<”n=”<<n<<”\n”;
}
};

int main( )
{
demo d( );
d.display( );
return 0;
}

The programmer did not declare a constructor in class C -- an implicit default


constructor was declared and defined by the implementation in order to create an
instance of class C.

TYPES OF CONSTRUCTOR
1. Default Constructor (No Argument Constructor)
2. Pamamerterized Constructor
3. Copy Constructor

DEFAULT CONSTRUCTOR:

This constructor has no arguments in it. Default Constructor is also called as no


argument constructor.

For example:

#include<iostream.h>
class con
{ private:
int a,b;
public:
con()
{
a=10;
b=20;
cout<<a<<endl;
cout<<b<<endl;

}
};

void main()
{
con c;
}

PARAMETERIZEDCONSTRUCTOR:

This constructor has arguments in it. It is used to initialize the data members of class.

For example:
Page 25
#include<iostream.h>
class con
{ private:
int a,b;
public:
con(int m,int n)
{
a=m;
b=n;
cout<<a<<endl;
cout<<b<<endl;

}
};

void main()
{
int j,k;
cout<<”Enter the value of J and K”;
cin>>j>>k;
con c(j,k);
}

COPY CONSTRUCTOR

This constructor takes one argument. Also called one argument constructor. The main
use of copy constructor is to initialize the objects while in creation, also used to copy
an object. The copy constructor allows the programmer to create a new object from an
existing one by initialization.

For example to invoke a copy constructor the programmer writes:

viva v1(v2);
or
viva v1=v2;

Both the above formats can be sued to invoke a copy constructor.

For Example:

#include<iostream.h>
class viva
{ private:
int a;
public:
viva()
{
}
viva(int w)
{
a=w;
}
viva(viva& e)
{
a=e.a;
cout<<”Copy Constructor”;

Page 26
}
void result()
{
cout<< a;
}
};
void main()
{ viva v1(50);
viva v3(e1);
cout<<e3.result();
}

DESTRUCTORS
Destructors are also special member functions used in C++ programming language. Destructors have
the opposite function of a constructor. The main use of destructors is to release dynamic allocated
memory. Destructors are used to free memory, release resources and to perform other clean up.
Destructors are automatically named when an object is destroyed. Like constructors, destructors also
take the same name as that of the class name.

General Syntax of Destructors

~ classname();

#include<iostream.h>
class k
{
int a,b;
public:
k(int x,int y) //parameterized constructor
{
a=x;
b=y;
}

~k( ) //destructor function


{
cout<<”\n Destructing the object:”;
}

void show( ) //function declare


{
cout<<”\n a =”<<a<<”b=”<<b;
}
};
void main( )
{
k obj(6,8);
obj.show( );
}

CONSTRUCTORS AND DESTRUCTORS SHOULD BE MINIMAL

When you are designing a class, remember that it might serve as a base for other
subclasses. It can also be used as a member object in a larger class. As opposed to
ordinary member functions, which can be overridden or simply not called, the base
Page 27
class constructor and destructor are automatically invoked. It is not a good idea to
force users of a derived and embedded object to pay for what they do not need, but are
forced to accept. In other words, constructors and destructors should contain nothing
but the minimal functionality needed to construct an object and destroy it.

ENCAPSULATION

The packaging of data values and member functions within one object is called an encapsulation. It is
also called data hiding which helps to maintain the integrity of the object. It saves the data from misuse
and outside interference. The data cannot be accessed directly but access controls can be specified in
order to obtain the information. The data or object can be made public or private depending on the
needs. The data which is private is not accessible outside the scope of the object. When the data is
public it can be accessed by the other parts of the program.

#include<iostream>
class rectangle
{
private:
double length;
public:
double breadth;
double area( )
{
return(length*breadth);
}
double len( )
{
return(length);
}
rectangle(double lenght1,double breadth1)
{
length=lenght1;
breadth=breadth1;
}
};

int main()
{
rectangle r1(3.5,4.6);
double a=r1.len( );
double b=r1.breadth;
cout << "The lenght is : " << a << endl;
cout << "The breadth is : " << b << endl;
cout << "The area is : " << r1.area( ) << endl;
return(0);
}

INHERITANCE
When creating a class, instead of writing completely new data members and member functions, the
programmer can designate that the new class should inherit the members of an existing class. This
existing class is called the base class, and the new class is referred to as the derived class and this
phenomenon is called “Inheritance”.
There are five types of inheritances. They are following-

Page 28
1. Single Inheritance
2. Multiple Inheritance
3. Multilevel Inheritance
4. Hierarchal Inheritance
5. Hybrid Inheritance

SINGLE INHERITANCE
When a class can inherit members from only one class is called “SINGLE INHERITANCE”. There
are two classes one becomes base class which is called and the caller class is called drive class.

Example:

#include <iostream>

// Base class

class Shape

{ public:

void setWidth(int w)

{ width = w;

void setHeight(int h)

{ height = h;

protected:

int width;

int height;

};

// Derived class

class Rectangle: public Shape

{ public:

int getArea()

{ return (width * height);

Page 29
};

int main(void)

{ Rectangle Rect;

Rect.setWidth(5);

Rect.setHeight(7);

cout << "Total area: " << Rect.getArea() << endl;

return 0;

MULTIPLE INHERITANCE
When a class can inherit members from more than one class is called “MULTIPLE INHERITANCE”.

Example:
#include <iostream.h>
// Base class Shape
class Shape
{ public:
void setWidth(int w)
{ width = w;
}
void setHeight(int h)
{ height = h;
}
protected:
int width;
int height;
};
// Base class PaintCost
class PaintCost
{ public:
int getCost(int area)
{
return area * 70;
}
};
// Derived class
class Rectangle: public Shape, public PaintCost
{ public:
int getArea()
{ return (width * height);
}

Page 30
};

int main(void)
{ Rectangle Rect;
int area;
Rect.setWidth(5);
Rect.setHeight(7);
area = Rect.getArea();
cout << "Total area: " << Rect.getArea() << endl;
cout << "Total paint cost: $" << Rect.getCost(area) << endl;
return 0;
}

MULTILEVEL INHERITANCE

In this type of inheritance the derived class inherits from a class, which in turn inherits
from some other class. The Super class for one, is sub class for the other.

#include <iostream.h>
class base
{ public:
void base_display( )
{
cout<<”Base Class”
}

};

class drive_one : public base


{ public:
void drive_display_one( )
{ base_display( );
cout<<”Derive First Class”
}

};

class drive_two : public drive_one


{ public:
void drive_display_two( )
{ drive_display_two( );
cout<<”Derive Second Class”
}

};

void main( )
{
drive_two d;
d. drive_display_two( );
}

Page 31
HIERARCHICAL INHERITANCE

In this type of inheritance, multiple derived classes inherits from a single base class.

#include <iostream.h>
class base
{ public:
void base_display( )
{
cout<<”Welcome to”;
}

};

class drive_one : public base


{ public:
void drive_display_one( )
{ base_display( );
cout<<”Derive First Class”
}

};

class drive_two : public base


{ public:
base_display( );
cout<<”Derive Second Class”
}

};

void main( )
{ drive_one d1;
d1. drive_display_one( );
drive_two d2;
d2. drive_display_two( );
}

HYBRID (VIRTUAL) INHERITANCE

Hybrid Inheritance is combination of Hierarchical and Mutilevel Inheritance.

Page 32
PLOYMORPHISM

The process of representing one Form in multiple forms is known as Polymorphism.


Here one form represent original form or original method always resides in base class
and multiple forms represents overridden method which resides in derived classes.
Polymorphism is derived from 2 greek words: poly and morphs. The word "poly"
means many and morphs means forms. So polymorphism means many forms.

Polymorphism means having multiple forms of one thing. In inheritance, polymorphism is done, by

method overriding, when both super and sub class have member function with same declaration bu

different definition.

Types of polymorphism

 Compile time polymorphism

 Run time polymorphism

Compile time polymorphism

In C++ programming you can achieve compile time polymorphism in two way, they
are-

 Method (Function) overloading

 Method (Function) overriding

FUNCTION OVERLOADING

Page 33
When multiple definitions for the same function name in the same scope is called “Function
overloading”. The definition of the function must differ from each other by the types and/or the number
of arguments in the argument list. You can not overload function declarations that differ only by return
type.
Example:

#include <iostream.h>
class printData
{
public:
void print(int i)
{
cout << "Printing int: " << i << endl;
}

void print(double f)
{
cout << "Printing float: " << f << endl;
}

void print(char* c)
{
cout << "Printing character: " << c << endl;
}
};

int main(void)
{
printData pd;
pd.print(5);
pd.print(500.263);
pd.print("Hello C++");
return 0;
}

FUNCTION (METHOD) OVERRIDING

Define any method in both base class and derived class with same name, same
parameters or signature, this concept is known as method overriding. In below
example same method "show()" is present in both base and derived class with same
name and signature (prototype).

Example
#include<iostream.h>
#include<conio.h>

class Base
{
public:
void show()
{
cout<<"Base class";
}
};
class Derived:public Base
{

Page 34
public:
void show()
{
cout<<"Derived Class";
}
}

int mian()
{
Base b; //Base class object
Derived d; //Derived class object
b.show(); //Early Binding Occurs
d.show();
getch();
}

Run time polymorphism


In C++ Run time polymorphism can be achieve by using virtual function.

VIRTUAL FUNCTION
A virtual function is a function in a base class that is declared using the keyword virtual. Defining in a
base class a virtual function, with another version in a derived class, signals to the compiler that we
don't want static linkage for this function.
What we do want is the selection of the function to be called at any given point in the program to be
based on the kind of object for which it is called. This sort of operation is referred to as dynamic
linkage, or late binding.
Example:
#include<iostream.h>
#include<conio.h>
class A
{
public:
virtual void show( )
{
cout<<"Hello base class";
}
};

class B : public A

Page 35
{
public:
void show( )
{
cout<<"Hello derive class";
}
};

void main( )
{
clrscr( );
A aobj;
B bobj;
A *bptr;
bptr=&aobj;
bptr->show(); // call base class function

bptr=&bobj;
bptr->show(); // call derive class function
getch();
}

Page 36
SYSTEM STUDY

INTRODUCTION

After analyzing the requirements of the task to be performed, the next step is
toanalyze the problem and understand its context. The first activity in the phase is to
studying the existing system and other is to understand the requirements and domain
of the new system. Both the activities are equally important but the first activity
serves as a basis of giving the functional specifications and then successful design of
the proposed system. Understanding the properties and requirements of a new system
is more difficult and requires creative thinking as well as understanding of existing
system is also difficult. Improper understanding of present system can lead diversion
from solution

FEASIBILITY STUDY

Feasibility is a measure of how beneficial the development of the application will be


to an organization. This is done by investigating the existing system in the area under
investigation or generally ideas about a new system. It is a test of a system proposal
according to its workability, impact on the organization, ability to meet user needs,
and effective use of resources.
The key considerations are involved in the feasibility analysis are:
Economic, Technical, Legal, Operational and Behavioral feasibility.

.
ECONOMIC FEASIBILITY

Economic analysis is the most frequently used method for evaluating the effectiveness
of a proposed system. It is more commonly known as cost benefit analysis, the
procedure to determine the benefits and saving that are expected from a candidate
system and compare them with costs. If the benefits outweigh costs then a decision is
made to design and implement the system. Otherwise make alterations in the
proposed system. The innovation of the new system has much influence on the
economical side of the company. Manual system is highly cost driven due to the high
labour costs. So if we register with the Dreamweaver, they can automate their day-to-
day activities. Thus the system is economically feasible.

TECHNICAL FEASIBILITY

In examining Technical feasibility of the system, more importance is given to the


hardware interaction part of the system. In Dreamweaver Permission to the users
would be granted based on the roles specified. Therefore, it provides the technical
guarantee of accuracy, reliability and security. Dreamweaver does not require any
addition hardware or software. Since the interface for this system is developed using
the existing resources and technologies available at NIC, There is nominal
expenditure and feasibility for certain.

Page 37
SYSTEM ANALYSIS

UML DIAGRAMS

Unified Modeling Language (UML) is a standardized general-purpose modeling


language in the field of software engineering. It is used to modify, visualize,
construct, specify and document the artifacts of an object-oriented software intensive
system under development. UML combines best techniques from data modeling (ER
diagrams), business modeling, object modeling, and component modeling. It can be
used with all processes, throughout a software development life cycle.

CLASS DIAGRAM

Class diagram in the UML is a type of static structure diagram that describes
theMstructure of a system by showing the system's classes, their attributes, and the
relationships between the classes. It is the main building block in object oriented
modelling. It is being used both for general conceptual modelling of the systematic of
the application, and for detailed modelling translating the models into programming
code.
The classes in a class diagram represent both the main objects and interactions in the
application and the objects to be programmed. In the class diagram these
classes are
represented with boxes which contain 3 parts:
The upper part holds the name of the class.
The middle part contains the attributes of the class, and
The bottom part gives the methods or operations the class can take

USE CASE DIAGRAM

Use case diagram in the Unified Modeling Language (UML) is a type of behavioral
diagram defined by and created from a Use-case analysis. Its purpose is to present a
graphical overview of the functionality provided by a system in terms of actors, their
goals (represented as use cases), and any dependencies between those use cases. Its
main purpose is to show what system functions are performed for which actor.
Roles of the actors in the system can be depicted

Page 38
SYSTEM TESTING

INTRODUCTION TO TESTING
Software testing is a critical element of software quality assurance and represents the
ultimate review of specification, design and coding. The increasing visibility of
software as a system element and attendant costs associated with a software failure
are motivating factors for we planned, through testing. Testing is the process of
executing a program with the intent of finding an error. The design of tests for
software and other engineered products can be as challenging as the initial design of
the product itself. There of basically two types of testing approaches. One is Black-
Box testing – the specified function that a product has been designed to
perform, tests can be conducted that demonstrate each function is fully operated
The other is White-Box testing – knowing the internal workings of the
product ,tests can be conducted to ensure that the internal operation of the
product performs according to specifications and all internal components have
been adequately exercised.

Testing Principles:
All tests should be traceable to customer requirements.
The focus of testing will shift progressively from programs. Exhaustive
testing is not possible. To be more effective, testing should be one, which
has probability of finding errors.

The following are the attributes of good test:

A good test has a high probability of finding an error.


A good test is not redundant.
A good test should be “best of breed”.
A good test should neither too simple nor too complex.

Levels Of Testing
The details of the software functionality tests are given below.
The testing procedure that has been used is as follows:

1. Unit Testing
2. Integration Testing
3. Validation Testing

Page 39
4. Output Testing
5. User acceptance system
6. Performance Testing

UNIT TESTING:

This testing method considers a module as single unit and checks the unit at interfaces
and communicates with other modules rather than getting into details at statement
level. Here the module will be treated as a black box, which will take some input and
generate output. Outputs for a given set of input combination are pre-calculated and
are generated by the module.

SYSTEM TESTING:

Here all the pre tested individual modules will be assembled to create the larger
system and tests are carried out at system level to make sure that all modules are
working in synchronous with each other. This testing methodology helps in making
sure that all modules which are running perfectly when checked individually are also
running in cohesion with other modules. For this testing we create test cases to check
all modules once and then generated test combinations of test paths through out the
system to make sure that no path is making its way into chaos.

INTEGRATED TESTING

Testing is a major quality control measure employed during software development.


Its basic function is to detect errors. Sub functions when combined may not produce
than it is desired. Global data structures can represent the problems. Integrated
testing is a systematic technique for constructing the program structure while
conducting the tests. To uncover errors that are associated with interfacing the
objective is to make unit test modules and built a program structure that has been
detected by design. In a non - incremental integration all the modules are combined
in advance and the program is tested as a whole. Here errors will appear in an end
less loop function. In incremental testing the program is constructed and tested in
small segments where the errors are isolated and corrected.

VALIDATION TESTING
The next level of testing is validation testing. Here the entire
software is tested. The reference document for this process is he requirement
and the goal is to see if the software meets its requirements.
The requirement document reflects and determines whether the
software functions the user expected. At the culmination of the integration
testing, software is completely assembled as a package, interfacing and

Page 40
corrected and a final series of software test and validation test begins. The proposed
system under construction has been tested by Using validation testing and found
to be working satisfactory.

OUTPUT TESTING
The output of the software should be acceptable to the system
user. The output requirements are defined during the system analysis. Testing of
the software system id done against the output requirements and the output testing
was completed with success.

USER ACCEPTANCE SYSTEM


An acceptance test has the objective of selling the user on the
validity and reliability of the system. It verifies that the systems procedures
operate to system specification and make the integrity of vital data is maintained.

PERFORMANCE TESTING
This project is a system-based project, and the modules are
interdependent with the other modules, so the testing cannot be done module by
module. So the unit testing is not possible in the case of this driver. So this system
is checked only with their performance to check their quality.

In case of the Unit testing the initialization module is first tested. Since
read module and the write module is interdependent theperformance testing is done
only after the final phase of coding.

Page 41
SNAPSHOTS

Page 42
FIRST PAGE

Page 43
START QUIZ

Page 44
QUIZ

Page 45
QUIZ NEXT LEVEL

Page 46
HIGH SCORE

Page 47
RESULTS AND ADVANTAGES

INTERPRETATION OF THE RESULT


The system has been implemented and tested successfully. It meets the
information Requirements specified to the great extent. Although the system
has been designed keeping the Present and future requirements in mind and
made very flexible. There are limitations of the System. Proper consideration
has been given for a wide range of new enhancements in The future,
throughout the development of system. The system is developed user friendly.
In future, if it is required to generate reports other than provided by the
system, it can be simply achieved by a separate module to the main menu
without affecting the design of the system.

ADVANTAGES

 It simplifies the operation.


 It avoids a lot of manual work.
 Every Transaction is obtained and processed immediately.
 Avoids errors by avoiding the manual work.
 User friendly screen to enter the data and Enquire the database tables.
 Online help messages available to the operating system.
 User can easily access the system without much experience.
 Provide Hardware and software securities.
 Portable and flexible for further extension.

Page 48
CONCLUSION & FUTURE WORK

This project is successfully completed and works properly

according to the needs this project is developed in C++. The system

maintains data consistency by avoiding manual error & sock are maintained

accurately which reduces the losses that can be made due to various

environment features. All the requirement regard to this problem are solved

the needs specified in the problem definition are fulfilled. This project will

help all end users as a user-friendly system.

Page 49
BIBILIOGRAPHY

C++ BY E-BALAGAUSWAMY

WWW.TUTORIALPOINTCOM

THE COMPLETE REFRENCE – C & C++

Page 50

You might also like