anurag
anurag
Training Report
On
Submitted By:
RAGHAV
DUGGAL
1222210
Submitted to:
(Raghav Duggal )
ACKNOWLEDGEMENT
The writing of this training report has been assisted by the generous help of many people. I feel
that I was very fortunate to receive assistance from them. I wish to express my sincere
appreciation to them.
First and foremost, I am indebted to my principal supervisor, Er./Mr. Manjit Singh (Director)
of Oops InfoSolutions Pvt ltd. who has been very supportive at every stage of my preparations.
I wish to express my utmost gratitude to him for his invaluable advice and patience in reading,
correcting and commenting on the drafts of the report and, more importantly, for his generosity
which I have received throughout my training program.
I would like to acknowledge and extended my heartfelt gratitude to Dr. Gaurav Sharma, Head
of Department who provided me the golden opportunity to undergo and complete this training
program.
I wish to express my thanks to Er. Rajiv Bansal who also helped me in conducting this study
and encouraged me throughout this journey.
PRIYA MEHTA
1222136
PREFACE
This curriculum based summer training program provided an understanding about building
application using C++.
Throughout the training program, I not only developed technical expertise but also cultivated critical
problem-solving skills, logical thinking, and the ability to design and implement solutions for real-
world challenges.
The journey of learning to program is a continuous process of growth and exploration. This training
program provided me with a strong foundation, and I had the opportunity to nurture and expand my
knowledge. I actively participated, asked questions, sought guidance, and experimented with the
concepts I learned. Embracing the challenges allowed me to emerge from this summer training as a
confident programmer, ready to take on exciting coding adventures.
Overall, this training program was an enriching experience. It was a journey of discovery and
learning as I explored the fascinating world of C++ programming and successfully built a cricket
game application that showcased my skills and creativity. I am grateful for the knowledge gained and
look forward to applying it to future projects.
TABLE OF CONTENTS
1. Declaration…………………………………………………….3
2. Acknowledgement…………………………………………4
3. Preface………………………………………….................5
4.Company Profile................................................6-8
CHAPTER 1
1. About C++……………………………………………………....10
2. C++ keywords………………………………………………….12
3. Operators………………………………………………………...15
4. Typecasting…………………………………………………….....19
5. Control Statements………………………………………......20
7. C++ Functions……………………………………………….......26
8. Class……………………………………………………………….......31
9. Object…………………………………………………………..........32
11. Pointers……………………………………………………..........35
CHAPTER 2
12. Introduction to the Project………………………...36
14. Output……………………………..............................47
COMPANY PROFILE
OOPS INFO SOLUTIONS PVT .LTD.
(Manjit Singh, Ex-Infosys employee,15 Year experience in IT, Java, J2EE, PHP, Android, Networking)
Oops Info Solutions was established in 2003. It’s foundation and purpose is to provide and construct programs for existing companies and
provide new and exciting updates to primitive bases technology.
Oops Info Solutions Pvt. Ltd. is a India-based IT service provider offering services for technology infrastructure, enterprise resource planning,
software application engineering and imparting Training. Oops was established on January 2003 and has consistently grown its client base.
Featured in Computer Times, IT India and Computer World, With India as the base for centralized Project Management, Oops has expanded
its representative office both in Chandigarh and Mohali in 2003. Oops also started operating software development center in the year 2004 and
2006. In 2011, Oops was nominated in “Spirit of Enterprise”, which advocates and promotes entrepreneurial spirit of Indians.
Oops is currently a registered member of Professional Training and Software Development. Oops is also ISO Certified Company. In 2013-14
Oops has also entered in Developing Mobile Apps.
It is currently working in Designing mobile apps and integrating apps with the Websites.
Board of Directors
The Group Management Board comprises the Vice Chairman & Managing Director, Presidents of the Business Sectors as well as heads of
certain key corporate functions. The Board provides strategic direction and enterprise leadership, facilitates synergistic and symbiotic
relationships and creates a shared vision and value-system, across the various Business Units and Companies that make up the OOPS group.
The membership of the Group Management Board is as follows:
Manjit Singh (Managing Director)
Gurpreet Kaur (Executive Director)
Developments in software technology have been always dynamic. New languages like C++ Programming and new techniques like oops
concepts are announced everyday; as a result, engineers and software industries need to track the new changes to continue the development.
However, there are many programming languages, but the Object-Oriented Programming Language is the most preferred one in the software
industry. It offers the user a new approach to build the real-time application along with a way to cope the complexity of other programs. Among
the oops languages available, C++ Programming is the most widely used one. Moreover, it is the most versatile language used for handling
very large programs and suitable for programming task including development of compilers, editors and any real-time complications The ability
to map the real life problems, makes C++ programming the most popular and the most important course for the software industry. It would be
indeed to say that there are many colleges and institutes, which give training of this course to students. Among the institutes available, Oops
Info Solutions Chandigarh is one among them offering this course for a term of 2 months. Oops Info Solutions has extensive experience
trainers to guide the students for real-time projects. Apart from the course, it also assures the enrolled students for 100% placement
opportunity. Most of the times, the seats are booked in advance.
TRAINING SCHEDULE w.e.f. JULY 10, 2023
Time Contents
Duration
INTRODUCTORY In the very begining,I stepped up into the corporate world .,knowing the importance
WEEK of projects ,certifications courses and internship programs interacting with number of
people in domain.
(10JULY-16JULY)
Getting Started with C++: The training commenced with a solid foundation in C++,
one of the foundational programming languages that laid the groundwork for modern
WEEK-1 programming. I learned to set up my development environment, wrote my initial C++
(JULY 17-JULY programs, and gained familiarity with the language's basic syntax and concepts.
23)
Fundamentals of Object-Oriented Programming (OOP) Using C++: In this segment,
I learned the principles of Object-Oriented Programming (OOP) through the lens of
WEEK-2 C++. I created classes, objects, and implemented concepts such as encapsulation,
(JULY 24 – JULY 30)
inheritance, and polymorphism.
WEEK-3 Completed the 3rd module and had a firm grasp of all the concepts of
(JULY 31 – Object-Oriented Programming (OOP) Using C++.
AUGUST 6)
Diving into C++ Programming: Building upon my C++ foundation, I ventured into
WEEK-4 more advanced features and techniques within the language. Topics included
memory management, file handling, and advanced data structures. This phase of the
(AUGUST 7-
training enabled me to write efficient and maintainable C++ code
AUGUST 13)
WEEK-5 Building a Real World Customer PaymentSystem: The pinnacle of this training
program was the practical application of my newly acquired skills. I applied my C++
(AUGUST 14- knowledge to design and implement a billing and payment system from scratch. This
AUGUST 20)
real-world project encompassed user interactions,logics and the creation of an
engaging user experience.
WEEK-6 Completed the project and also gave the Final test. Received the certificate of
completion
(AUGUST 20-
AUGUST 25)
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++.
#include<conio.h>
int main()
class”; return 0;
Lines beginning with a hash sign (#) are directives read and interpreted by what is known as the preprocessor. They are special
lines interpreted before the compilation of the program itself begins.
In this case, the directive #include , instructs the preprocessor 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 :
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 signaled by returning a nonzero value.
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 :
1.3 Identifires
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.
C++ allows certain of the basic types to have modifiers preceding them. A modifier alters the meaning of the base type so that
it more precisely fits the needs of various situations. The data type modifiers are: signed, unsigned, long and short.
This figure shows all combinations of the basic data types and modifiers along with their size and range for a 16-bit word
machine
1.5 Variables
A variable is a named area in memory used to store values during program execution. Variables are run time entities. A
variable has a symbolic name and can be given a variety of values. When a variable is given a value, that value is actually placed
in the memory space assigned to the variable. All variables must be declared before they can be used. The general form of a
declaration is:
type variable_list;
Here, type must be a valid data type plus any modifiers, and variable_list may consist of one or more identifier names
separated by commas. Here are some declarations:
int i,j,l;
1.6 Constants
Constants refer to fixed values that the program cannot alter. Constants can be of any of the basic data types. The way each
constant is represented depends upon its type. Constants are also called literals. We can use keyword const prefix to declare
constants with a specific type as follows:
value; e.g.,
1.7 Operator
An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. C++ is rich in built-in
operators. Generally, there are six type of operators: Arithmetical operators, Relational operators, Logical operators,
Assignment operators, Conditional operators, Comma operator.
Arithmetical operators
Operator Meaning
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus
You can use the operators +, -, *, and / with both integral and floating-point data types. Modulus or remainder % operator is
used only with the integral data type.
== Equal to
!= Not equal to
Operators Meaning
|| OR
&& AND
! NOT
For example:
m = 5;
The operator takes the expression on the right, 5, and stores it in the variable on the left,
m. x = y = z = 32;
This code stores the value 32 in each of the three variables x, y, and z. In addition to standard assignment operator
shown above, C++ also support compound assignment operators.
+= A+=2 A=A+2
-= A-=2 A=A–2
%= A%=2 A=A%2
/= A/ = 2 A=A/2
*= A*=2 A = A *2
Post-increment: variable++
decrement: variable–
–
In Prefix form first variable is first incremented/decremented, then evaluated In Postfix form first variable is first
evaluated, then incremented / decremented.
If the value of conditional expression is true then the expression1 is evaluated, otherwise expression2 is evaluated.
int a = 5, b = 6;
big = (a > b) ? a : b;
The condition evaluates to false, therefore big gets the value from b and it becomes 6.
i = (a, b); // stores b into i would first assign the value of a to i, and then assign value of b to variable i. So, at the end, variable i
would contain the value 2.
For example
The problem with this is, that you get a warning (normally you want to compile without warnings and errors) and you are not in
control. With control we mean, you did not decide to convert to another type, the compiler did.
▪ static_cast
▪ reinterpret_cast
▪ const_cast
▪ dynamic_cast
When a user can convert the one data type into then it is called as the type casting.
The type Conversion is performed by the compiler but a casting is done by the user for example converting a float into int.
When we use the Type Conversion then it is called the promotion.
In the type casting when we convert a large data type into another then it is called as the demotion. When we use the type
casting then we can loss some data.
1. If Statement
if(condition)
If the condition evaluates to true, then the block of code inside the if statement will be executed. If it evaluates to false, then
the first set of code after the end of the if statement (after the closing curly brace) will be executed .
#include<iostream.h>
#include<conio.h>
int main()
int n ;
if(n%2==0)
cout<<”Even number”;else
cout<<”Odd number”;return 0;
}
2.If…else Statement
The syntax is shown as:
(condition){
else{
If the condition evaluates to true ,then the if block of code will be executed ,otherwise else block of code will be executed.
if(condition 1){
else {
4.Nested if Statement
It is always legal to nest if-else statements , which means you can use one if or else if statement inside another if or else if
statement(s).
}
1.10.2 Loop control structures
A loop statement allows us to execute a statement or group of statements multiple times. Loops or iterative statements tell the
program to repeat a fragment of code several times or as long as a certain condition holds. C++ provides three convenient
iterative statements: while, for, and do-while.
1. while loop
A while loop statement repeatedly executes a target statement as long as a given condition is true. It is an entry-controlled
loop.
while(condition){
statement(s);
Here, statement(s) may be a single statement or a block of statements. The condition may be any expression, and true is any
non-zero value. The loop iterates while the condition is true. After each execution of the loop, the value of test expression is
changed. When the condition becomes false, program control passes to the line immediately following the loop.
Flowchart
#include<conio.h>
int main(){
int i=1;
while(i<=100)
cout<<i;
i++;
return 0;
2. do while loop
The do-while loop differs from the while loop in that the condition is tested after the body of the loop.This assures that the
program goes through the iteration at least once. It is an exit-controlled loop.
do{
statement(s);
}while(condition);
The conditional expression appears at the end of the loop, so the statement(s) in the loop execute once before the condition is
tested .If the condition is true ,the flow of control jumps back up to do,and the statement(s) in the loop execute again. This
process repeats until the given condition becomes false .
// A program to display numbers from 1 to 100
#include<iostream.h>
#include<conio.h>
int main(){
int i=1;
do
cout<<i;
i++;
}while(i<=100);
return 0;
3. for loop
A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of
times . The syntax of a for loop in C++ is :
for(int i; condition;increment)
statement(s);
}
#include<iostream.h>
#include<conio.h>
int main() {
int i;
for(i=1;i<=100;i++)
cout<< i;
return 0;
A function has to be declared before using it, in a manner similar to variables and constants. A function declaration tells the
compiler about a function's name, return type, and parameters and how to call the function. The general form of a C++
function declaration is as follows:
Function definition
The function definition is the actual body of the function. The function definition consists of two parts namely, function header
and function body.
Here, Return Type: A function may return a value. The return_type is the data type of the value the function returns. Some
functions perform the desired operations without returning a value. In this case, the return_type is the keyword void.
Parameters: A parameter is like a placeholder. When a function is invoked, you pass a value to the parameter. This value is
referred to as actual parameter or argument. The parameter list refers to the type, order, and number of the parameters of a
function. Parameters are optional; that is, a function may contain no parameters.
Function Body: The function body contains a collection of statements that define what the function does.
1.12 Inline Functions
An inline function is a function that is expanded inline at the point at which it is invoked, instead of actually being called. The
reason that inline functions are an important addition to C++ is that they allow you to create very efficient code. Each time a
normal function is called,
a significant amount of overhead is generated by the calling and return mechanism. Typically, arguments are pushed onto the
stack and various registers are saved when a function is called, and then restored when the function returns. The trouble is that
these instructions take time.
However, when a function is expanded inline, none of those operations occur. Although expanding function calls in line can
produce faster run times, it can also result in larger code size because of duplicated code. The compiler can choose to ignore it.
Also, some compilers may not inline all types of functions. If a function cannot be inlined, it will simply be called as a normal
function.
A function can be defined as an inline function by prefixing the keyword inline to the function header as given below:
{ function body }
int no, f;
int factorial(int n)
{ int i,fact=1;for(i=1;i<=n;i++){fact=fact*i;
return fact;
#include<iostream.h>
#include<conio.h>
{ if(x>y)
return x;
else
return y;
int main()
{ int a,b;
cin>>a>>b;
return 0;
inline functions are similar to macros (because the function code is expanded at the point of the call at compile time), inline
functions are parsed by the compiler, whereas macros are expanded by the preprocessor. As a result, there are several
important differences:
▪ Inline functions follow all the protocols of type safety enforced on normalfunctions.
▪ Inline functions are specified using the same syntax as any other function except that they include the inline keyword in the
functiondeclaration.
▪ In some cases, expressions passed as arguments to macros can be evaluated more thanonce.
▪ macros are expanded at pre-compile time, you cannot use them for debugging, but you can use inline functions.
1.13 Reference Variable
A reference variable is an alias, that is, another name for an already existing variable. Once a reference is initialized with a
variable, either the variable name or the reference name may be used to refer to the variable. To declare a reference variable
or parameter, precede the variable's name with the &. The syntax for declaring a reference variable is:
Example:
int main(){
return 0;
var2 is a reference variable to var1.Hence, var2 is an alternate name to var1.This code prints the value of var2 exactly as that of
var1.
Arguments can be passed to functions in one of two ways: using call-by-value or call-byreference. When using call-by-value, a
copy of the argument is passed to the function. Callby-reference passes the address of the argument to the function. By
default, C++ uses call-byvalue.
Provision of the reference variables in c++ permits us to pass parameter to the functions by reference. When we pass
arguments by reference, the formal arguments in the called function become aliases to the actual arguments in the calling
function. This means that when the function is working with its own arguments, it is actually working on the original data.
Example
#include<iostream.h>
#include<conio.h>
int main() {
int a=10,b=20;
cout<<”Before swapping”<<endl;
cout<<”After swapping”<<endl;
return 0;
int temp;
x=y;
y=temp;
Default arguments are useful if you don’t want to go to the trouble of writing arguments that, for example, almost always have
the same value. They are also useful in cases where, after a program is written, the programmer decides to increase the
capability of a function by adding another argument. Using default arguments means that the existing function calls can
continue to use the old number of arguments, while new function calls can use more.
Example
#include <iostream.h>
#include<conio.h>
return(a+b);
int main(){
int a=100,b=200,result;
return 0;
1.15 Class
A class is a user defined data type. A class is a logical abstraction. It is a template that defines the form of an object. A class
specifies both code and data. It is not until an object of that class has been created that a physical representation of that class
exists in memory. When you define a class, you declare the data that it contains and the code that operates on that data. Data
is contained in instance variables defined by the class known as data members, and code is contained in functions known as
member functions. The code and data that constitute a class are called members of the class. The general form of class
declaration is:
class class-name {
access-specifier:
// ...
access-specifier:
} object-list;
The object-list is optional. If present, it declares objects of the class. Here, access-specifier is one of these three C++ keywords:
By default, functions and data declared within a class are private to that class and may be accessed only by other members of
the class. The public access specifier allows functions or data to be accessible to other parts of your program. The protected
access specifier is needed only when inheritance is involved.
Example :
#include<iostream.h>
#include<conio.h>
int get_a();
};
1.16 Object
An object is an identifiable entity with specific characteristics and behavior. An object is said to be an instance of a class.
Defining an object is similar to defining a variable of any data type: Space is set aside for it in memory. Defining objects in this
way means creating them. This is also called instantiating them. Once a Class has been declared, we can create objects of that
Class by using the class Name like any other built-in type variable as shown:
className
objectName Example
void main( ) {
myclass ob1, ob2; //these are object of type myclass
//…program code
The main() cannot contain statements that access class members directly. Class members can be accessed only by an object of
that class. To access class members, use the dot (.) operator. The dot operator links the name of an object with the name of a
member. The general form of the dot operator is shown here:
object.member
Example
ob1.set_a(10);
The private members of a class cannot be accessed directly using the dot operator, but through the member functions of that
class providing data hiding. A member function can call another member function directly ,without using the dot operator.
#include<iostream.h>
#include<conio.h>
class A{
int a,b,c;
public :
void sum(){
cin>>a>>b;
c=a+b;
cout<<”sum=”<<c;
};
int main(){
A u;
u.sum();
getch();
return 0;
// body of function
Here the class-name is the name of the class to which the function belongs. The scope resolution operator (::) tells the
compiler that the function func-name belongs to the class classname. That is, the scope of the function is restricted to the
class-name specified.
public:
a=num;
int myclass::get_a( )
{ return a; }
Another use of scope resolution operator is to allow access to the global version of a variable. In many situation, it happens
that the name of global variable and the name of the local variable are same .
1.18 Pointer
A pointer is a variable that contains a memory address. Very often this address is the location of another object, such as a
variable. For example, if x contains the address of y, then x is said to “point to” y. Pointer variables must be declared as such.
The general form of a pointer variable declaration is
type *var-name;
Here, type is the pointer’s base type. The base type determines what type of data the pointer will be pointing to. var-name is
the name of the pointer variable.
To use pointer:
• Finally access the value at the address available in the pointer variable. This is done by using unary operator * that returns
the value of the variable located at the address specified by its operand.
Example:
// normal variable
int a =10;
Chapter 2
2.Introduction to project
Project for Customer Payment and billing System in C++ with code- This C++ grocery store billing system is a straightforward
console program without any visuals .You will learn how to use the stream class and manage files in the C++ programming
language with this project.
The supermarket billing system is intended to help supermarkets calculate and show invoices,as well as provides faster and
more effective customer service.The user interface of this software solution is both efficient and user-friendly ,helping staff
members with customer service bill calculation.
Identifying the C++ libraries that our software will require as a first step. At the commencement of the presentation, these will
be given. The header files are imported using #include from a library ,iostream is the first library that our app needs .We will
use this library to manage our supermarket billing project using C++ basic input and output.
Main purpose
A Billing system is a software application that is used to manage the process of invoicing and payment collection for products
or or services provided by a business . The purpose of a billing system is to automate the billing process ,making it more
efficient and accurate .
The main purpose of billing system is to streamline the billing process for a business , making it easier to generate invoices and
collect payment from the customer . The system can be used to generate invoices ,track payments ,and generate reports on
billing activity.
Overall, the purpose of billing system is to improve the efficiency and accuracy of the billing process ,making it easier for a
business to manage its finances and provide quality service to its customers .
What to expect ?
Here are some features that Customer Payment and Billing System Shows -
1. New Entry
2. To View Previous Entry
3. Exit
New Entry :- If a new customer buy something then the record of the items and the payment record is shown by this project.To
view previous Entry :- If one customer or owner wants to know the list of items bieng sold ,he can use the previous entries to
calculate details.Exit :- To exit from the project , there will be an exit option .
SOURCE CODE:
OUTPUT: