CERTIFICATE
This is to certify that Sudhindra Mudhol of class
XII B has satisfactorily and successfully completed the
investigatory project in Computer Science as prescribed by
CBSE for AISSCE course, in the Computer Science
laboratory of Kendriya Vidyalaya 2, Jalahalli East, in the
academic session 2013-2014.
Roll No :
Date :
Signature: External Examiner
Signature: Teacher in charge
AKNOWLEDGEMENT
I offer my sincere thanks to my Computer
Science teacher Mrs. Leena.U (PGT Computer
Science), for her valuable guidance and advice. I
am also thankful to her for giving me useful
suggestions and relevant ideas which facilitated
an easy completion of this project.
I am also thankful to our Principal mam
Mrs. Suleena Nair, and my School - Kendriya
Vidyalaya No.2 for giving me such an
opportunity to work on this Investigatory
Project.
- Sudhindra Mudhol
INDEX (CONTENTS)
Introduction
Project requirements
Source code
Output gallery
Bibliography
INTRODUCTION
Most computer programs work with the files
because files help in storing information
permanently. Word processors create
documents files.
Database programs create document files.
Compilers reads source files and generate
executable files. So, a file itself is a bunch of
bytes stored on some storage device. In C++, file
input/output facilities are implemented
through a component header file of C++
standard library. This header file is fstream.h. It
helps in file manipulation which is closer to the
real world.
Project
requirments
Turbo C++ software.
Microsoft paint.
Microsoft Office.
Computer system
requirments
A 32 bit or 64 bit Operating system .
Windows XpTM
or Higher version .
Intel PentiumTM
, Intel Core2DuoTM
or Higher version Chip set .
Command prompt TURBO C++ .
PROGRAMMING
(Source code)
//***********************************************
// STAR BILLING SYSTEM
// Header Files Included
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
#include<process.h>
#include<stdio.h>
#include<fstream.h>
#include<string.h>
//Function prototype declaration
void main_menu();
void add_shop();
void show_shop();
void rem_shop();
void mod_shop();
void cus_slip();
// Global Variables
char g;
float today_sale=0;
class shop // Class for the products' records
{
int code;
float price;
char name[32];
public :
void getdata()
{
cout<<"nEnter Item code => ";
cin>>code;
cout<<"nEnter Item name => ";
gets(name);
cout<<"nEnter Price => ";
cin>>price;
}
void putdata()
{
cout<<"Item Code => "<<code<<"t Price => "<<price<<"t Name => ";
puts(name);
}
int getcode()
{
return code;
}
float getp()
{
return price;
}
}; //end of class
void main() // Main Function of the program
{
clrscr();
char n[32];
cout<<"nnEnter username => ";
cin>>n;
if( ( (strcmp(n,"Kunal")==0) || (strcmp(n,"Mohit")==0)||(strcmp(n,”Sudhi”)==0) ) )
{ main_menu(); }
else
{
cout<<"nInvalid Username !!! ";
cout<<"nDo you want to retry (y/n) => ";
cin>>g;
if (g=='y') { main(); }
else { exit(0); }
}
getch();
} // End of the main function
void main_menu() // Function for displaying main_menu
{
clrscr();
cout<<"ntt*********************";
textattr(9+128);
textbackground(15);
cprintf(" t AFWWA t ");
textattr(15);
cout<<"************************";
cout<<"ntt ( Air Force Wives Welfare Association )";
int ch;
cout<<"nChoose from the selected option(s) --> nn";
textattr(6);
cprintf("1 . Add item to the Shop "); cout<<endl;
cprintf("2 . Remove item from the the Shop "); cout<<endl;
cprintf("3 . Modify Details of a item"); cout<<endl;
cprintf("4 . Show all available items"); cout<<endl;
cprintf("5 . Customer Slip"); cout<<endl;
cprintf("6 . Today's sale "); cout<<endl;
cprintf("7 . Exit");
cout<<"nnEnter your choice => ";
cin>>ch;
switch(ch)
{
case 1:
add_shop();
break;
case 2:
rem_shop();
break;
case 3:
mod_shop();
break;
case 4:
show_shop();
break;
case 5:
cus_slip();
break;
case 6:
{
clrscr();
cout<<"nToday's total sale => "<<today_sale;
cout<<"nnnDo you want to go to main menu (y/n) => ";
cin>>g;
if(g=='y')
main_menu();
}
break;
case 7:
exit(0);
break;
default:
cout<<"nInvalid Choice !!n";
cout<<"nChoose againn";
} //Switch case closed
} //End of main function
void add_shop() // Function to adding items to Shop
{
clrscr();
textattr(15);
cout<<"ntt*********************";
textbackground(15);
textattr(9);
cprintf(" t AFWWA t ");
cout<<"************************ntt ( Air Force Wives Welfare Association )";
fstream f1;
shop s1;
char c='y';
f1.open("affwa.txt",ios::app|ios::binary);
while(c== 'y')
{
cout<<"nnEnter the detail of the Item => ";
s1.getdata();
f1.write( (char*)&s1,sizeof(s1));
cout<<"nDo you want to enter more details (y/n) => ";
cin>>c;
}
f1.close();
cout<<"nDo you want to go main menu (y/n) => ";
cin>>g;
if(g=='y')
{
clrscr();
main_menu();
}
else
{ exit(0); }
} // End of add_shop() function
void show_shop() // Function to show all available items
{
clrscr();
fstream f1;
shop s1;
cout<<"nt**** Item list ****n";
f1.open("affwa.txt",ios::in|ios::binary);
f1.seekg(0,ios::beg);
while(!f1.eof())
{
f1.read((char*)&s1,sizeof(s1));
cout<<"n";
s1.putdata();
}
f1.close();
cout<<"nDo you want to go to main menu (y/n) => ";
cin>>g;
if(g=='y')
main_menu();
else
exit(0);
} // End of show_shop() function
void mod_shop() // Function for modifying details of items
{
clrscr();
int k;
fstream f1;
shop s1;
cout<<"nEnter the item code whoose data is to be modified => ";
cin>>k;
f1.open("affwa.txt",ios::in|ios::binary);
f1.seekg(0,ios::beg);
int pos;
while(!f1.eof())
{
pos=f1.tellg();
f1.read((char*)&s1,sizeof(s1));
if ( k==s1.getcode() )
{
cout<<"nEnter new details => n";
s1.getdata();
f1.seekp(pos);
f1.write((char*)&s1,sizeof(s1));
break;
}
}
f1.close();
main_menu();
}
void rem_shop() // Function for removing the details of a item
{
clrscr();
fstream m1,m2;
shop s1;
m1.open("affwa.txt",ios::in|ios::out|ios::binary);
m2.open("a_temp.txt",ios::out|ios::binary);
m1.seekg(0,ios::beg);
int k;
cout<<"nnEnter the item code whose record you want to delete => ";
cin>>k;
while(!m1.eof())
{
m1.read((char*)&s1,sizeof(s1));
if ( k==s1.getcode() ) { }
else { m2.write((char*)&s1,sizeof(s1)); }
}
m1.close();
m2.close();
remove("affwa.txt");
rename("a_temp.txt","affwa.txt");
cout<<"nThe item has been removed !!n ";
cout<<"nDo you want to go to main menu (y/n) => ";
cin>>g;
if(g=='y')
{
clrscr();
main_menu();
}
else { exit(0); }
}
void cus_slip() // Function for displaying customers’ bill
{
clrscr();
cout<<"ntt*************** Customer Slip **************nnn";
fstream f1;
shop s;
int qty;
float cost , tot_cost=0;
int tno;
f1.open("affwa.txt",ios::in|ios::binary);
f1.seekp(0,ios::beg);
char ch='y';
while(ch=='y') // while 1
{
while( !f1.eof()) // while 2
{
f1.read((char*)&s,sizeof(s));
cout<<"nEnter the item no .=> ";
cin>>tno;
if( (s.getcode())==tno ) // if 1
{
cout<<"nEnter quantity => ";
cin>>qty;
cost=qty*(s.getp());
tot_cost+=cost;
today_sale+=tot_cost;
cout<<"nCost => "<<cost;
} // if 1
cout<<"nDo you want to enter more items to your cart (y/n) => ";
cin>>ch;
if(ch=='y') { continue; }
else { break; }
} // while 2
} // while 1
f1.close();
cout<<"nnnTotal Amount to be paid by the Customer => "<<tot_cost;;
cout<<"nnDo you want to go to main menu (y/n) => ";
cin>>g;
if(g=='y') { main_menu(); }
}
Output gallery
1. Main Screen
2. Adding Items to the shop
3. All items Display
4. Customer Slip
BIBLOGRAPHY
Computer Science with C++ for Class XII
by Sumita Arora.
Computer Science Support Material,
2013-14 by Kendriya Vidyalaya
Sangathan.
Together with Computer Science
Textbook.

CS Project-Source code for shopping inventory for CBSE 12th

  • 2.
    CERTIFICATE This is tocertify that Sudhindra Mudhol of class XII B has satisfactorily and successfully completed the investigatory project in Computer Science as prescribed by CBSE for AISSCE course, in the Computer Science laboratory of Kendriya Vidyalaya 2, Jalahalli East, in the academic session 2013-2014. Roll No : Date : Signature: External Examiner
  • 3.
    Signature: Teacher incharge AKNOWLEDGEMENT I offer my sincere thanks to my Computer Science teacher Mrs. Leena.U (PGT Computer Science), for her valuable guidance and advice. I am also thankful to her for giving me useful suggestions and relevant ideas which facilitated an easy completion of this project. I am also thankful to our Principal mam Mrs. Suleena Nair, and my School - Kendriya Vidyalaya No.2 for giving me such an
  • 4.
    opportunity to workon this Investigatory Project. - Sudhindra Mudhol INDEX (CONTENTS) Introduction Project requirements
  • 5.
    Source code Output gallery Bibliography INTRODUCTION Mostcomputer programs work with the files because files help in storing information permanently. Word processors create documents files. Database programs create document files. Compilers reads source files and generate executable files. So, a file itself is a bunch of bytes stored on some storage device. In C++, file
  • 6.
    input/output facilities areimplemented through a component header file of C++ standard library. This header file is fstream.h. It helps in file manipulation which is closer to the real world. Project requirments Turbo C++ software. Microsoft paint.
  • 7.
    Microsoft Office. Computer system requirments A32 bit or 64 bit Operating system . Windows XpTM or Higher version .
  • 8.
    Intel PentiumTM , IntelCore2DuoTM or Higher version Chip set . Command prompt TURBO C++ . PROGRAMMING (Source code) //*********************************************** // STAR BILLING SYSTEM // Header Files Included #include<iostream.h> #include<iomanip.h>
  • 9.
    #include<conio.h> #include<process.h> #include<stdio.h> #include<fstream.h> #include<string.h> //Function prototype declaration voidmain_menu(); void add_shop(); void show_shop(); void rem_shop(); void mod_shop(); void cus_slip(); // Global Variables char g; float today_sale=0; class shop // Class for the products' records { int code; float price; char name[32]; public : void getdata() { cout<<"nEnter Item code => ";
  • 10.
    cin>>code; cout<<"nEnter Item name=> "; gets(name); cout<<"nEnter Price => "; cin>>price; } void putdata() { cout<<"Item Code => "<<code<<"t Price => "<<price<<"t Name => "; puts(name); } int getcode() { return code; } float getp() { return price; } }; //end of class void main() // Main Function of the program { clrscr();
  • 11.
    char n[32]; cout<<"nnEnter username=> "; cin>>n; if( ( (strcmp(n,"Kunal")==0) || (strcmp(n,"Mohit")==0)||(strcmp(n,”Sudhi”)==0) ) ) { main_menu(); } else { cout<<"nInvalid Username !!! "; cout<<"nDo you want to retry (y/n) => "; cin>>g; if (g=='y') { main(); } else { exit(0); } } getch(); } // End of the main function void main_menu() // Function for displaying main_menu { clrscr(); cout<<"ntt*********************"; textattr(9+128); textbackground(15); cprintf(" t AFWWA t "); textattr(15); cout<<"************************";
  • 12.
    cout<<"ntt ( AirForce Wives Welfare Association )"; int ch; cout<<"nChoose from the selected option(s) --> nn"; textattr(6); cprintf("1 . Add item to the Shop "); cout<<endl; cprintf("2 . Remove item from the the Shop "); cout<<endl; cprintf("3 . Modify Details of a item"); cout<<endl; cprintf("4 . Show all available items"); cout<<endl; cprintf("5 . Customer Slip"); cout<<endl; cprintf("6 . Today's sale "); cout<<endl; cprintf("7 . Exit"); cout<<"nnEnter your choice => "; cin>>ch; switch(ch) { case 1: add_shop(); break; case 2: rem_shop(); break; case 3: mod_shop(); break;
  • 13.
    case 4: show_shop(); break; case 5: cus_slip(); break; case6: { clrscr(); cout<<"nToday's total sale => "<<today_sale; cout<<"nnnDo you want to go to main menu (y/n) => "; cin>>g; if(g=='y') main_menu(); } break; case 7: exit(0); break; default: cout<<"nInvalid Choice !!n"; cout<<"nChoose againn"; } //Switch case closed } //End of main function
  • 14.
    void add_shop() //Function to adding items to Shop { clrscr(); textattr(15); cout<<"ntt*********************"; textbackground(15); textattr(9); cprintf(" t AFWWA t "); cout<<"************************ntt ( Air Force Wives Welfare Association )"; fstream f1; shop s1; char c='y'; f1.open("affwa.txt",ios::app|ios::binary); while(c== 'y') { cout<<"nnEnter the detail of the Item => "; s1.getdata(); f1.write( (char*)&s1,sizeof(s1)); cout<<"nDo you want to enter more details (y/n) => "; cin>>c; } f1.close(); cout<<"nDo you want to go main menu (y/n) => "; cin>>g;
  • 15.
    if(g=='y') { clrscr(); main_menu(); } else { exit(0); } }// End of add_shop() function void show_shop() // Function to show all available items { clrscr(); fstream f1; shop s1; cout<<"nt**** Item list ****n"; f1.open("affwa.txt",ios::in|ios::binary); f1.seekg(0,ios::beg); while(!f1.eof()) { f1.read((char*)&s1,sizeof(s1)); cout<<"n"; s1.putdata(); } f1.close(); cout<<"nDo you want to go to main menu (y/n) => ";
  • 16.
    cin>>g; if(g=='y') main_menu(); else exit(0); } // Endof show_shop() function void mod_shop() // Function for modifying details of items { clrscr(); int k; fstream f1; shop s1; cout<<"nEnter the item code whoose data is to be modified => "; cin>>k; f1.open("affwa.txt",ios::in|ios::binary); f1.seekg(0,ios::beg); int pos; while(!f1.eof()) { pos=f1.tellg(); f1.read((char*)&s1,sizeof(s1)); if ( k==s1.getcode() ) { cout<<"nEnter new details => n";
  • 17.
    s1.getdata(); f1.seekp(pos); f1.write((char*)&s1,sizeof(s1)); break; } } f1.close(); main_menu(); } void rem_shop() //Function for removing the details of a item { clrscr(); fstream m1,m2; shop s1; m1.open("affwa.txt",ios::in|ios::out|ios::binary); m2.open("a_temp.txt",ios::out|ios::binary); m1.seekg(0,ios::beg); int k; cout<<"nnEnter the item code whose record you want to delete => "; cin>>k; while(!m1.eof()) { m1.read((char*)&s1,sizeof(s1)); if ( k==s1.getcode() ) { }
  • 18.
    else { m2.write((char*)&s1,sizeof(s1));} } m1.close(); m2.close(); remove("affwa.txt"); rename("a_temp.txt","affwa.txt"); cout<<"nThe item has been removed !!n "; cout<<"nDo you want to go to main menu (y/n) => "; cin>>g; if(g=='y') { clrscr(); main_menu(); } else { exit(0); } } void cus_slip() // Function for displaying customers’ bill { clrscr(); cout<<"ntt*************** Customer Slip **************nnn"; fstream f1; shop s; int qty; float cost , tot_cost=0;
  • 19.
    int tno; f1.open("affwa.txt",ios::in|ios::binary); f1.seekp(0,ios::beg); char ch='y'; while(ch=='y')// while 1 { while( !f1.eof()) // while 2 { f1.read((char*)&s,sizeof(s)); cout<<"nEnter the item no .=> "; cin>>tno; if( (s.getcode())==tno ) // if 1 { cout<<"nEnter quantity => "; cin>>qty; cost=qty*(s.getp()); tot_cost+=cost; today_sale+=tot_cost; cout<<"nCost => "<<cost; } // if 1 cout<<"nDo you want to enter more items to your cart (y/n) => "; cin>>ch; if(ch=='y') { continue; } else { break; }
  • 20.
    } // while2 } // while 1 f1.close(); cout<<"nnnTotal Amount to be paid by the Customer => "<<tot_cost;; cout<<"nnDo you want to go to main menu (y/n) => "; cin>>g; if(g=='y') { main_menu(); } } Output gallery 1. Main Screen
  • 21.
    2. Adding Itemsto the shop
  • 22.
    3. All itemsDisplay 4. Customer Slip
  • 23.
    BIBLOGRAPHY Computer Science withC++ for Class XII by Sumita Arora. Computer Science Support Material, 2013-14 by Kendriya Vidyalaya Sangathan. Together with Computer Science Textbook.