SlideShare a Scribd company logo
1 of 35
        <br />Submitted To: - Jasbir Kaur                              <br />                           Submitted     By:- Maninder Verma            <br />                                                        <br />        10+1 (j)   <br />        Govt. Sen. sec model school<br />                      P.A.U Ludhiana<br />                                 <br />ACKNOWLEDGEMENT<br />   On every step there is need of guidance, support and motivation. This encourages a <br />   person to give his best performance and helps in reaching his goals.<br />   This project is prepared in partial fulfillment of the requirements for the 10+1 (J) and <br />   here we wish to take this opportunity to express our sincere gratitude to all those who <br />   directly or indirectly helped us in completing this project.<br />   First of all, we would like to pay our especially thanks to Mrs.JASBIR KAUR who<br />   had taught us Programming in c++ and helped us during this project development work<br />   and for completion of this project.<br />   We pay our sincere thanks to Mr.NIPUL JAIN (software engineer in M.N.C) for his<br />   kind cooperation and providing us ample facilities. <br />   At the end, we express our gratitude to parents and friends who have always been the <br />   source of encouragement and inspiration.<br /> <br />                    <br />SrNo.ContentsPage No.1.Program for Addition12.Program for switch statement2-33.Program for GOTO statement44.Program for IF IF statement45.Program for while statement56.Program for FOR loop67.Program for FORFOR loop7-88.Program for leep year9-139.Program for swapping1410.Program for Fibnoacce15-2011.Program for Factorial 21-3212.Program for making table of any any number3-3813.Program for virtual function39-4014.Program for check eligibility for vote41-4315.Program for HYBRID Inharitance  44-4716.Program for father&son multipal Inharitance48-5017.Program for bank Inharitance51-5618.Program for class train57-6819.Program for simple inheritance with teacher69-7120.Program for  hospital Multipal Inharitance72-74<br />   <br />1: ADDITION:<br />#include<iostream.h><br />#include<conio.h><br />void main()<br />{<br />int a,b,c;<br />clrscr();<br />cout<<quot;
Enter any two numbersquot;
;<br />cin>>a>>b;<br />c=a+b;<br />cout<<quot;
The addition isquot;
<<c;<br />getch();<br />}<br />2: SWITCH statement:<br />#include<iostream.h><br />#include<conio.h><br />void main()<br />{<br />int n;<br />clrscr();<br />cout<<quot;
************ created by Maninder vemra and co************quot;
;<br />cout<<quot;
enter you choice between 1 to 10quot;
;<br />cout<<quot;
enter your choice==>quot;
;<br />cin>>n;<br />switch(n)<br />{<br />case 1:<br />cout<<quot;
sundayquot;
;<br />break;<br />case 2:<br />cout<<quot;
mondayquot;
;<br />break;<br />case 3:<br />cout<<quot;
tuesdayquot;
;<br />break;<br />case 4:<br />cout<<quot;
wednesdayquot;
;<br />break;<br />case 5:<br />cout<<quot;
thrusdayquot;
;<br />break;<br />case 6:<br />cout<<quot;
fridayquot;
;<br />break;<br />case 7:<br />cout<<quot;
saturdayquot;
;<br />break;<br />default:<br />cout<<quot;
invalid numberquot;
;<br />}<br />getch();<br />}<br />3: GOTO statement:<br /># include<iostream.h><br /># include<conio.h><br />void main()<br />{<br />int y;<br />clrscr();<br />a:<br />cout<<quot;
*********** Created by Maninder verma and company ***********quot;
;<br />cout<<quot;
*********** program for goto statement **********quot;
;<br />cout<<quot;
Enter any year to know it is leep year or notquot;
;<br />cout<<quot;
Enter your year here===>>quot;
;<br />cin>>y;<br />if (y%4==0)<br />{<br />cout<<quot;
your entered year is a leep yearquot;
;<br />}<br />else<br />{<br />cout<<quot;
this is not a leep yearquot;
;<br />}<br />getch();<br />goto a;<br />}<br />4: IF-IF statement:<br />#include<iostream.h><br />#include<conio.h><br />void main()<br />{<br />int a,b;<br />cout<<quot;
koi do number add kar oequot;
;<br />cin>>a>>b;<br />if (a>b)<br />{<br />cout<<quot;
pehla number vada haquot;
;<br />}<br />If (a<b)<br />{<br />cout<<”duja number vada ha”;<br />}<br />getch();<br />}<br />5: WHILE statement:<br /># include<iostream.h><br /># include<conio.h><br />void main()<br />{<br />int i=5;<br />clrscr();<br />cout<<quot;
***********Created by maninder verma and company***********quot;
;<br />while (i>=1)<br />{<br />cout<<i<<endl;<br />i--;<br />}<br />getch();<br /> } <br /> <br />6: FOR loop:<br /># include<iostream.h><br /># include<conio.h><br />void main()<br />{<br />int i;<br />cout<<quot;
************ Created by maninder verma and team***********quot;
;<br />for (i=1; i<=5; i++)<br />{<br />cout<<i<<endl;<br />}<br />getch();<br />}<br />7: FOR FOR loop:<br /># include<iostream.h><br /># include<conio.h><br />void main()<br />{<br />int i,j;<br />clrscr();<br />cout<<quot;
************** created by maninder verma and team ***********quot;
;<br />for (i=1; i<=5; i++)<br />{<br />cout<<quot;
quot;
;<br />cout<<i<<endl;<br />}<br />for (j=5; j>=1; j--)<br />{<br />cout<<quot;
                        quot;
;<br />cout<<j<<endl;<br />}<br />getch();<br />}<br />8: LEEP YEAR:<br />#include<iostream.h><br />#include<conio.h><br />void main()<br />{<br />int y;<br />cout <<quot;
koi ve year enter kar oequot;
;<br />cin>>y;<br />if (y%4==0)<br />{<br />cout<<quot;
year is leep yearquot;
;<br />}<br />else<br />{<br />cout<<quot;
year is not a leep yearquot;
;<br />}<br />getch();<br />}<br />9: SWAPPING:<br />#include<iostream.h><br />#include<conio.h><br />void main()<br />{<br />int x,y,z;<br />cout <<quot;
koi do number enter kar oequot;
;<br />cin>>x>>y;<br />z=x;<br />x=y;<br />y=z;<br />cout<<x<<y;<br />getch();<br />}<br />10: FIBNOACEE:<br /># include<iostream.h><br />#include<conio.h><br />class father<br />{<br />private:<br />int a;<br />char n[10];<br />public:<br />void getdata()<br />{<br />cout<<quot;
enter the  name of father==>quot;
;<br />cin>>a;<br />cout<<quot;
quot;
;<br />cout<<quot;
enter the age of father==>quot;
;<br />cin>>n;<br />cout<<quot;
quot;
;<br />}<br />void putdata()<br />{<br />cout<<quot;
name of fatherquot;
<<n;<br />cout<<quot;
age of fatherquot;
<<a;<br />}<br />};<br />class son: public father<br />{<br />private:<br />int p;<br />char n[10];<br />public:<br />void getdata1()<br />{<br />getdata();<br />cout<<quot;
enter phone of son==>quot;
;<br />cin>>p;<br />cout<<quot;
enter name of son==>quot;
;<br />cin>>n;<br />}<br />void putdata1()<br />{<br />putdata();<br />cout<<quot;
the phonequot;
<<p;<br />cout<<quot;
name isquot;
<<n;<br />}<br />};<br />void main()<br />{<br />son s;<br />clrscr();<br />s.putdata1();<br />s.getdata1();<br />getch();<br />}<br />11: FACTORIAL:<br /># include<iostream.h><br />#include<conio.h><br />void main()<br />{<br />int n,i,ans=1;<br />clrscr();<br />a:<br />cout<<quot;
******* created by and maninder ********quot;
;<br />cout<<quot;
enter any number==>quot;
;<br />cin>>n;<br />for (i=1; i<=n; i++)<br />{<br />ans=ans*i;<br />}<br />cout<<ans;<br />goto a;<br />getch();<br />}<br />12: TO MAKE  TABEL OF ANY NUMBER:<br /># include<iostream.h><br /># include<conio.h><br />void main()<br />{<br />long int n,i;<br />clrscr();<br />cout<<quot;
************ created by Maninder verma and team ************quot;
;<br />cout<<quot;
Enter any number==>quot;
;<br />cin>>n;<br />for (i=1; i<=10; i++)<br />{<br />cout<<n*i<<endl;<br />}<br />getch();<br />}<br />13: VIRTUAL FUNCTION:<br />#include<iostream.h><br />#include<conio.h><br />class father<br />{<br />private:<br />int a;<br />public:<br />void getdata()<br />{<br />cout<<quot;
enter age of fatherquot;
;<br />cin>>a;<br />}<br />void putdata()<br />{<br />cout<<quot;
the age of father isquot;
<<a;<br />}<br />};<br />class son:public father<br />{<br />private:<br />int a;<br />public:<br />virtual void getdata()<br />{<br />cout<<quot;
enter the age of sonquot;
;<br />cin>>a;<br />}<br />virtual void putdata()<br />{<br />cout<<quot;
the age of son isquot;
<<a;<br />}<br />};<br />void main()<br />{<br />father f;<br />father*p;<br />p=&f;<br />p->getdata();<br />p->putdata();<br />son s;<br />son*p1;<br />p1=&s;<br />p1->getdata();<br />p1->putdata();<br />getch();<br />}<br />15: HYBRID INHARITANCE: <br /># include<iostream.h><br /># include<conio.h><br />class grandfather<br />{<br />private:<br />int a;<br />char n[10];<br />public:<br />void getdata()<br />{<br />cout<<quot;
Enter the age of grandfather==>quot;
;<br />cin>>a;<br />cout<<quot;
quot;
;<br />cout<<quot;
Enter the name of grandfather==>quot;
;<br />cin>>n;<br />cout<<quot;
quot;
;<br />}<br />void putdata()<br />{<br />cout<<quot;
age of G.Fquot;
<<a;<br />cout<<quot;
quot;
;<br />cout<<quot;
name of G.Fquot;
<<n;<br />}<br />};<br />class father:public grandfather<br />{<br />private:<br />char a[10];<br />public:<br />void getdata1()<br />{<br />getdata();<br />cout<<quot;
Enter the name of fatherquot;
;<br />cin>>a;<br />}<br />void putdata1()<br />{<br />putdata();<br />cout<<quot;
the name of father isquot;
<<a;<br />}<br />};<br />class mother:public grandfather<br />{<br />private:<br />int p;<br />public:<br />void getdata2()<br />{<br />getdata();<br />cout<<quot;
Enter the phone no of motherquot;
;<br />cin>>p;<br />}<br />void putdata2()<br />{<br />putdata();<br />cout<<quot;
the phone no of mother isquot;
<<p;<br />}<br />};<br />class son:public father,mother<br />{<br />private:<br />char m[10];<br />public:<br />void getdata3()<br />{<br />getdata1();<br />getdata2();<br />cout<<quot;
Enter the marks of sonquot;
;<br />cin>>m;<br />cout<<quot;
quot;
;<br />}<br />void putdata3()<br />{<br />putdata1();<br />putdata2();<br />cout<<quot;
The marks of son isquot;
<<m;<br />}<br />};<br />void main()<br />{<br />son s;<br />clrscr();<br />s.getdata3();<br />s.putdata3();<br />getch();<br />}<br />15: MULTIPAL INHARITANCE: <br /># include<iostream.h><br />#include<conio.h><br />class father<br />{<br />private:<br />int a;<br />char n[10];<br />public:<br />void getdata()<br />{<br />cout<<quot;
enter the  name of father==>quot;
;<br />cin>>a;<br />cout<<quot;
quot;
;<br />cout<<quot;
enter the age of father==>quot;
;<br />cin>>n;<br />cout<<quot;
quot;
;<br />}<br />void putdata()<br />{<br />cout<<quot;
name of fatherquot;
<<n;<br />cout<<quot;
age of fatherquot;
<<a;<br />}<br />};<br />class son: public father<br />{<br />private:<br />int p;<br />char n[10];<br />public:<br />void getdata1()<br />{<br />getdata();<br />cout<<quot;
enter phone of son==>quot;
;<br />cin>>p;<br />cout<<quot;
enter name of son==>quot;
;<br />cin>>n;<br />}<br />void putdata1()<br />{<br />putdata();<br />cout<<quot;
the phonequot;
<<p;<br />cout<<quot;
name isquot;
<<n;<br />}<br />};<br />void main()<br />{<br />son s;<br />clrscr();<br />s.putdata1();<br />s.getdata1();<br />getch();<br />}<br />16: BANK:<br /># include<iostream.h><br /># include<conio.h><br />class bank<br />{<br />private:<br />char n;<br />public:<br />void getdata()<br />{<br />cout<<quot;
enter the name of bankquot;
;<br />cin>>n;<br />cout<<quot;
quot;
;<br />}<br />void putdata()<br />{<br />cout<<quot;
enter the name of bankquot;
;<br />cin>>n;<br />cout<<quot;
quot;
;<br />}<br />};<br />class manager<br />{<br />private:<br />char n[20];<br />int a;<br />public:<br />void getdata1()<br />{<br />cout<<quot;
enter the namequot;
;<br />cin>>n;<br />cout<<quot;
quot;
;<br />cout<<quot;
enter the agequot;
;<br />cin>>a;<br />cout<<quot;
quot;
;<br />}<br />void putdata1()<br />{<br />cout<<quot;
enter the name and agequot;
<<n<<a;<br />}<br />};<br />class coustmer: public bank,manager<br />{<br />private:<br />int p;<br />public:<br />void getdata2()<br />{<br />getdata();<br />getdata1();<br />cout<<quot;
enter the phonequot;
;<br />cin>>p;<br />}<br />void putdata2()<br />{<br />putdata();<br />putdata1();<br />cout<<quot;
the phone isquot;
<<p;<br />}<br />};<br />void main()<br />{<br />coustmer c;<br />clrscr();<br />c.getdata2();<br />c.putdata2();<br />getch();<br />}<br />18: CLASS TRAIN:<br />#include<iostream.h><br />#include<conio.h><br />class train<br />{<br />private:<br />int b;<br />int tn;<br />char s[20];<br />char d[20];<br />float l;<br />public:<br />train()<br />{<br />tn=479;<br />s=quot;
dehliquot;
;<br />d=quot;
chdquot;
;<br />l=52.95;<br />b=70;<br />}<br />void putdata()<br />{<br />cout<<quot;
the train no,source,destination and load copestequot;
<<tn<<s<<d<<l;<br />}<br />};<br />void main()<br />{<br />train.t;<br />t.putdata();<br />getch();<br />}<br />19: SIMPLE IHARITANCE (WITH TEACHER EXAMPLE)<br /># include<iostream.h><br /># include<conio.h><br />class teacher<br />{<br />private:<br />int a;<br />char n[10];<br />float i;<br />public:<br />void manny()<br />{<br />cout<<quot;
Enter the name of teacher==>quot;
;<br />cin>>n;<br />cout<<quot;
Enter the age of teacher==>quot;
;<br />cin>>a;<br />cout<<quot;
Enter the income of teacher==>quot;
;<br />cin>>i;<br />}<br />void verma()<br />{<br />cout<<quot;
Name of teacher is==>quot;
<<n<<endl;<br />cout<<quot;
quot;
;<br />cout<<quot;
Age of teacher is==>quot;
<<a<<endl;<br />cout<<quot;
quot;
;<br />cout<<quot;
Income of teacher is==>quot;
<<i<<endl;<br />}<br />};<br />void main()<br />{<br />clrscr();<br />teacher t;<br />t.manny();<br />t.verma();<br />getch();<br />}<br />20: HOSPITAL INHARITANCE:<br />#include<iostream.h><br />#include<conio.h><br />class hospital<br />{<br />private:<br />char n[10];<br />int h;<br />public:<br />void getdata()<br />{<br />cout<<quot;
Enter the name of hospital==>quot;
;<br />cin>>n;<br />cout<<quot;
quot;
;<br />cout<<quot;
Enter the height==>quot;
;<br />cin>>h;<br />}<br />void putdata()<br />{<br />cout<<quot;
quot;
;<br />cout<<quot;
Name of hospital==>quot;
<<n;<br />cout<<quot;
quot;
;<br />cout<<quot;
Height of hospital==>quot;
<<h;<br />}<br />};<br />class doctor: public hospital<br />{<br />private:<br />int a;<br />char n[10];<br />public:<br />void getdata1()<br />{<br />getdata();<br />cout<<quot;
quot;
;<br />cout<<quot;
enter the age of doctor==>quot;
;<br />cin>>a;<br />cout<<quot;
quot;
;<br />cout<<quot;
enter the name of doctor==>quot;
;<br />cin>>n;<br />cout<<quot;
quot;
;<br />}<br />void putdata1()<br />{<br />putdata();<br />cout<<quot;
age of doctor==>quot;
<<a;<br />cout<<quot;
name of doctor==>quot;
<<n;<br />}<br />};<br />void main()<br />{<br />doctor s;<br />s.getdata1();<br />s.putdata1();<br />getch();<br />}<br />Our project on punjab electricity bill calculater :<br /># include<iostream.h><br /># include<conio.h><br />void main()<br />{<br />int a;<br />long float cr,pr,u;<br />long float u0=2.40,u1=4.357,u2=3.91;<br />clrscr();<br />cout<<quot;
quot;
;<br />cout<<quot;
****** CREATED BY GROUP A OF P.A.U STUDENT *****quot;
;<br />cout<<quot;
quot;
;<br />cout<<quot;
SOFTWARE TO CALCULATE YOU ELECTRICITY BILLquot;
;<br />cout<<quot;
quot;
;<br />cout<<quot;
Enter your current reading from your bill==>   quot;
;<br />cin>>cr;<br />cout<<quot;
quot;
;<br />cout<<quot;
      Enter you previous reading==>   quot;
;<br />cin>>pr;<br />cout<<quot;
quot;
;<br />u=cr-pr;<br />cout<<quot;
                your used units==>    quot;
<<u<<endl;<br />cout<<quot;
quot;
;<br />if (u<=100)<br />{<br />a=u*u0;<br />}<br />if ((u>100)&&(u<=200))<br />{<br />a=u*u2;<br />}<br />else<br />{<br />a=u*u1;<br />}<br />cout<<quot;
                                                   -----------quot;
;<br />cout<<quot;
    your current bill amount is==>     quot;
<<a;<br />cout<<quot;
                                                                        -----------quot;
;<br />getch();<br />}<br />                            **********************<br />                               ******************<br />                                  ***************<br />                                     ************<br />                                       <br />                                                                                                                          <br />
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS
C++ PROGRAMS

More Related Content

Viewers also liked

Inventario en imagenes
Inventario en imagenesInventario en imagenes
Inventario en imagenesmacc
 
A simple guide to India's General Elections
A simple guide to India's General ElectionsA simple guide to India's General Elections
A simple guide to India's General ElectionsShivangini Tandon
 
Tetra threat framework for big bazaar
Tetra threat framework for big bazaarTetra threat framework for big bazaar
Tetra threat framework for big bazaarmj5082
 
Waterfront Market South Portland Maine Proposal J Une 2011
Waterfront Market   South Portland Maine Proposal J Une 2011Waterfront Market   South Portland Maine Proposal J Une 2011
Waterfront Market South Portland Maine Proposal J Une 2011Sergio Gaddar
 
Immagini per l’assemblea 2013
Immagini per l’assemblea 2013Immagini per l’assemblea 2013
Immagini per l’assemblea 2013accri
 

Viewers also liked (8)

Inventario en imagenes
Inventario en imagenesInventario en imagenes
Inventario en imagenes
 
Implementers guide 2010
Implementers guide 2010Implementers guide 2010
Implementers guide 2010
 
A simple guide to India's General Elections
A simple guide to India's General ElectionsA simple guide to India's General Elections
A simple guide to India's General Elections
 
Mm sample q important1
Mm sample q important1Mm sample q important1
Mm sample q important1
 
Tetra threat framework for big bazaar
Tetra threat framework for big bazaarTetra threat framework for big bazaar
Tetra threat framework for big bazaar
 
Waterfront Market South Portland Maine Proposal J Une 2011
Waterfront Market   South Portland Maine Proposal J Une 2011Waterfront Market   South Portland Maine Proposal J Une 2011
Waterfront Market South Portland Maine Proposal J Une 2011
 
Agency credential of blueray part 1
Agency credential of blueray part 1Agency credential of blueray part 1
Agency credential of blueray part 1
 
Immagini per l’assemblea 2013
Immagini per l’assemblea 2013Immagini per l’assemblea 2013
Immagini per l’assemblea 2013
 

Similar to C++ PROGRAMS

Pooja Sharma , BCA Third Year
Pooja Sharma , BCA Third YearPooja Sharma , BCA Third Year
Pooja Sharma , BCA Third YearDezyneecole
 
Deepika Mittal , BCA Third Year
Deepika Mittal , BCA Third YearDeepika Mittal , BCA Third Year
Deepika Mittal , BCA Third Yeardezyneecole
 
Gaurav Jatav , BCA Third Year
Gaurav Jatav , BCA Third YearGaurav Jatav , BCA Third Year
Gaurav Jatav , BCA Third Yeardezyneecole
 
Bhanu Pratap Singh Shekhawat, BCA Third Year
Bhanu Pratap Singh Shekhawat, BCA Third YearBhanu Pratap Singh Shekhawat, BCA Third Year
Bhanu Pratap Singh Shekhawat, BCA Third YearDezyneecole
 
Mithlesh Singh Rawat , BCA Third Year
Mithlesh Singh Rawat , BCA Third YearMithlesh Singh Rawat , BCA Third Year
Mithlesh Singh Rawat , BCA Third Yeardezyneecole
 
Ronak Kachhawa , BCA Third Year
Ronak Kachhawa , BCA Third YearRonak Kachhawa , BCA Third Year
Ronak Kachhawa , BCA Third YearDezyneecole
 
Step adivasi chetna 20 1-15
Step adivasi chetna 20 1-15Step adivasi chetna 20 1-15
Step adivasi chetna 20 1-15Jauhar Jauhar
 
Deepak Soni ,BCA Third Year
Deepak Soni ,BCA Third YearDeepak Soni ,BCA Third Year
Deepak Soni ,BCA Third YearDezyneecole
 
Hardik Jadam , BCA Third Year
Hardik Jadam , BCA Third YearHardik Jadam , BCA Third Year
Hardik Jadam , BCA Third Yeardezyneecole
 
GHULAM ISHAQ CV Assistant engr,electrical technician
GHULAM ISHAQ CV  Assistant engr,electrical technicianGHULAM ISHAQ CV  Assistant engr,electrical technician
GHULAM ISHAQ CV Assistant engr,electrical technicianGHULAM ISHAQ
 
Deepika Mittal , BCA Third Year
Deepika Mittal , BCA Third YearDeepika Mittal , BCA Third Year
Deepika Mittal , BCA Third Yeardezyneecole
 
Vinita Vaishnav , BCA Third Year
Vinita Vaishnav , BCA Third YearVinita Vaishnav , BCA Third Year
Vinita Vaishnav , BCA Third YearDezyneecole
 
Ram Prasad , BCA Third Year
Ram Prasad , BCA Third YearRam Prasad , BCA Third Year
Ram Prasad , BCA Third YearDezyneecole
 
Rounit Mathur , BCA Third Year
Rounit Mathur , BCA Third YearRounit Mathur , BCA Third Year
Rounit Mathur , BCA Third YearDezyneecole
 
Shivani Chouhan , BCA Third Year
Shivani Chouhan , BCA Third YearShivani Chouhan , BCA Third Year
Shivani Chouhan , BCA Third YearDezyneecole
 
Kajal Gaharwal , BCA Third Year
Kajal Gaharwal , BCA Third YearKajal Gaharwal , BCA Third Year
Kajal Gaharwal , BCA Third YearDezyneecole
 

Similar to C++ PROGRAMS (20)

Pooja Sharma , BCA Third Year
Pooja Sharma , BCA Third YearPooja Sharma , BCA Third Year
Pooja Sharma , BCA Third Year
 
Deepika Mittal , BCA Third Year
Deepika Mittal , BCA Third YearDeepika Mittal , BCA Third Year
Deepika Mittal , BCA Third Year
 
Gaurav Jatav , BCA Third Year
Gaurav Jatav , BCA Third YearGaurav Jatav , BCA Third Year
Gaurav Jatav , BCA Third Year
 
Bhanu Pratap Singh Shekhawat, BCA Third Year
Bhanu Pratap Singh Shekhawat, BCA Third YearBhanu Pratap Singh Shekhawat, BCA Third Year
Bhanu Pratap Singh Shekhawat, BCA Third Year
 
Mithlesh Singh Rawat , BCA Third Year
Mithlesh Singh Rawat , BCA Third YearMithlesh Singh Rawat , BCA Third Year
Mithlesh Singh Rawat , BCA Third Year
 
Ronak Kachhawa , BCA Third Year
Ronak Kachhawa , BCA Third YearRonak Kachhawa , BCA Third Year
Ronak Kachhawa , BCA Third Year
 
Step adivasi chetna 20 1-15
Step adivasi chetna 20 1-15Step adivasi chetna 20 1-15
Step adivasi chetna 20 1-15
 
Deepak Soni ,BCA Third Year
Deepak Soni ,BCA Third YearDeepak Soni ,BCA Third Year
Deepak Soni ,BCA Third Year
 
Hardik Jadam , BCA Third Year
Hardik Jadam , BCA Third YearHardik Jadam , BCA Third Year
Hardik Jadam , BCA Third Year
 
Pavan Resume
Pavan ResumePavan Resume
Pavan Resume
 
GHULAM ISHAQ CV Assistant engr,electrical technician
GHULAM ISHAQ CV  Assistant engr,electrical technicianGHULAM ISHAQ CV  Assistant engr,electrical technician
GHULAM ISHAQ CV Assistant engr,electrical technician
 
Deepika Mittal , BCA Third Year
Deepika Mittal , BCA Third YearDeepika Mittal , BCA Third Year
Deepika Mittal , BCA Third Year
 
CV
CVCV
CV
 
Vinita Vaishnav , BCA Third Year
Vinita Vaishnav , BCA Third YearVinita Vaishnav , BCA Third Year
Vinita Vaishnav , BCA Third Year
 
Ram Prasad , BCA Third Year
Ram Prasad , BCA Third YearRam Prasad , BCA Third Year
Ram Prasad , BCA Third Year
 
Rounit Mathur , BCA Third Year
Rounit Mathur , BCA Third YearRounit Mathur , BCA Third Year
Rounit Mathur , BCA Third Year
 
Shivani Chouhan , BCA Third Year
Shivani Chouhan , BCA Third YearShivani Chouhan , BCA Third Year
Shivani Chouhan , BCA Third Year
 
Resume.doc
Resume.docResume.doc
Resume.doc
 
rishi k patel
rishi k patelrishi k patel
rishi k patel
 
Kajal Gaharwal , BCA Third Year
Kajal Gaharwal , BCA Third YearKajal Gaharwal , BCA Third Year
Kajal Gaharwal , BCA Third Year
 

C++ PROGRAMS

  • 1. <br />Submitted To: - Jasbir Kaur <br /> Submitted By:- Maninder Verma <br /> <br /> 10+1 (j) <br /> Govt. Sen. sec model school<br /> P.A.U Ludhiana<br /> <br />ACKNOWLEDGEMENT<br /> On every step there is need of guidance, support and motivation. This encourages a <br /> person to give his best performance and helps in reaching his goals.<br /> This project is prepared in partial fulfillment of the requirements for the 10+1 (J) and <br /> here we wish to take this opportunity to express our sincere gratitude to all those who <br /> directly or indirectly helped us in completing this project.<br /> First of all, we would like to pay our especially thanks to Mrs.JASBIR KAUR who<br /> had taught us Programming in c++ and helped us during this project development work<br /> and for completion of this project.<br /> We pay our sincere thanks to Mr.NIPUL JAIN (software engineer in M.N.C) for his<br /> kind cooperation and providing us ample facilities. <br /> At the end, we express our gratitude to parents and friends who have always been the <br /> source of encouragement and inspiration.<br /> <br /> <br />SrNo.ContentsPage No.1.Program for Addition12.Program for switch statement2-33.Program for GOTO statement44.Program for IF IF statement45.Program for while statement56.Program for FOR loop67.Program for FORFOR loop7-88.Program for leep year9-139.Program for swapping1410.Program for Fibnoacce15-2011.Program for Factorial 21-3212.Program for making table of any any number3-3813.Program for virtual function39-4014.Program for check eligibility for vote41-4315.Program for HYBRID Inharitance 44-4716.Program for father&son multipal Inharitance48-5017.Program for bank Inharitance51-5618.Program for class train57-6819.Program for simple inheritance with teacher69-7120.Program for hospital Multipal Inharitance72-74<br /> <br />1: ADDITION:<br />#include<iostream.h><br />#include<conio.h><br />void main()<br />{<br />int a,b,c;<br />clrscr();<br />cout<<quot; Enter any two numbersquot; ;<br />cin>>a>>b;<br />c=a+b;<br />cout<<quot; The addition isquot; <<c;<br />getch();<br />}<br />2: SWITCH statement:<br />#include<iostream.h><br />#include<conio.h><br />void main()<br />{<br />int n;<br />clrscr();<br />cout<<quot; ************ created by Maninder vemra and co************quot; ;<br />cout<<quot; enter you choice between 1 to 10quot; ;<br />cout<<quot; enter your choice==>quot; ;<br />cin>>n;<br />switch(n)<br />{<br />case 1:<br />cout<<quot; sundayquot; ;<br />break;<br />case 2:<br />cout<<quot; mondayquot; ;<br />break;<br />case 3:<br />cout<<quot; tuesdayquot; ;<br />break;<br />case 4:<br />cout<<quot; wednesdayquot; ;<br />break;<br />case 5:<br />cout<<quot; thrusdayquot; ;<br />break;<br />case 6:<br />cout<<quot; fridayquot; ;<br />break;<br />case 7:<br />cout<<quot; saturdayquot; ;<br />break;<br />default:<br />cout<<quot; invalid numberquot; ;<br />}<br />getch();<br />}<br />3: GOTO statement:<br /># include<iostream.h><br /># include<conio.h><br />void main()<br />{<br />int y;<br />clrscr();<br />a:<br />cout<<quot; *********** Created by Maninder verma and company ***********quot; ;<br />cout<<quot; *********** program for goto statement **********quot; ;<br />cout<<quot; Enter any year to know it is leep year or notquot; ;<br />cout<<quot; Enter your year here===>>quot; ;<br />cin>>y;<br />if (y%4==0)<br />{<br />cout<<quot; your entered year is a leep yearquot; ;<br />}<br />else<br />{<br />cout<<quot; this is not a leep yearquot; ;<br />}<br />getch();<br />goto a;<br />}<br />4: IF-IF statement:<br />#include<iostream.h><br />#include<conio.h><br />void main()<br />{<br />int a,b;<br />cout<<quot; koi do number add kar oequot; ;<br />cin>>a>>b;<br />if (a>b)<br />{<br />cout<<quot; pehla number vada haquot; ;<br />}<br />If (a<b)<br />{<br />cout<<”duja number vada ha”;<br />}<br />getch();<br />}<br />5: WHILE statement:<br /># include<iostream.h><br /># include<conio.h><br />void main()<br />{<br />int i=5;<br />clrscr();<br />cout<<quot; ***********Created by maninder verma and company***********quot; ;<br />while (i>=1)<br />{<br />cout<<i<<endl;<br />i--;<br />}<br />getch();<br /> } <br /> <br />6: FOR loop:<br /># include<iostream.h><br /># include<conio.h><br />void main()<br />{<br />int i;<br />cout<<quot; ************ Created by maninder verma and team***********quot; ;<br />for (i=1; i<=5; i++)<br />{<br />cout<<i<<endl;<br />}<br />getch();<br />}<br />7: FOR FOR loop:<br /># include<iostream.h><br /># include<conio.h><br />void main()<br />{<br />int i,j;<br />clrscr();<br />cout<<quot; ************** created by maninder verma and team ***********quot; ;<br />for (i=1; i<=5; i++)<br />{<br />cout<<quot; quot; ;<br />cout<<i<<endl;<br />}<br />for (j=5; j>=1; j--)<br />{<br />cout<<quot; quot; ;<br />cout<<j<<endl;<br />}<br />getch();<br />}<br />8: LEEP YEAR:<br />#include<iostream.h><br />#include<conio.h><br />void main()<br />{<br />int y;<br />cout <<quot; koi ve year enter kar oequot; ;<br />cin>>y;<br />if (y%4==0)<br />{<br />cout<<quot; year is leep yearquot; ;<br />}<br />else<br />{<br />cout<<quot; year is not a leep yearquot; ;<br />}<br />getch();<br />}<br />9: SWAPPING:<br />#include<iostream.h><br />#include<conio.h><br />void main()<br />{<br />int x,y,z;<br />cout <<quot; koi do number enter kar oequot; ;<br />cin>>x>>y;<br />z=x;<br />x=y;<br />y=z;<br />cout<<x<<y;<br />getch();<br />}<br />10: FIBNOACEE:<br /># include<iostream.h><br />#include<conio.h><br />class father<br />{<br />private:<br />int a;<br />char n[10];<br />public:<br />void getdata()<br />{<br />cout<<quot; enter the name of father==>quot; ;<br />cin>>a;<br />cout<<quot; quot; ;<br />cout<<quot; enter the age of father==>quot; ;<br />cin>>n;<br />cout<<quot; quot; ;<br />}<br />void putdata()<br />{<br />cout<<quot; name of fatherquot; <<n;<br />cout<<quot; age of fatherquot; <<a;<br />}<br />};<br />class son: public father<br />{<br />private:<br />int p;<br />char n[10];<br />public:<br />void getdata1()<br />{<br />getdata();<br />cout<<quot; enter phone of son==>quot; ;<br />cin>>p;<br />cout<<quot; enter name of son==>quot; ;<br />cin>>n;<br />}<br />void putdata1()<br />{<br />putdata();<br />cout<<quot; the phonequot; <<p;<br />cout<<quot; name isquot; <<n;<br />}<br />};<br />void main()<br />{<br />son s;<br />clrscr();<br />s.putdata1();<br />s.getdata1();<br />getch();<br />}<br />11: FACTORIAL:<br /># include<iostream.h><br />#include<conio.h><br />void main()<br />{<br />int n,i,ans=1;<br />clrscr();<br />a:<br />cout<<quot; ******* created by and maninder ********quot; ;<br />cout<<quot; enter any number==>quot; ;<br />cin>>n;<br />for (i=1; i<=n; i++)<br />{<br />ans=ans*i;<br />}<br />cout<<ans;<br />goto a;<br />getch();<br />}<br />12: TO MAKE TABEL OF ANY NUMBER:<br /># include<iostream.h><br /># include<conio.h><br />void main()<br />{<br />long int n,i;<br />clrscr();<br />cout<<quot; ************ created by Maninder verma and team ************quot; ;<br />cout<<quot; Enter any number==>quot; ;<br />cin>>n;<br />for (i=1; i<=10; i++)<br />{<br />cout<<n*i<<endl;<br />}<br />getch();<br />}<br />13: VIRTUAL FUNCTION:<br />#include<iostream.h><br />#include<conio.h><br />class father<br />{<br />private:<br />int a;<br />public:<br />void getdata()<br />{<br />cout<<quot; enter age of fatherquot; ;<br />cin>>a;<br />}<br />void putdata()<br />{<br />cout<<quot; the age of father isquot; <<a;<br />}<br />};<br />class son:public father<br />{<br />private:<br />int a;<br />public:<br />virtual void getdata()<br />{<br />cout<<quot; enter the age of sonquot; ;<br />cin>>a;<br />}<br />virtual void putdata()<br />{<br />cout<<quot; the age of son isquot; <<a;<br />}<br />};<br />void main()<br />{<br />father f;<br />father*p;<br />p=&f;<br />p->getdata();<br />p->putdata();<br />son s;<br />son*p1;<br />p1=&s;<br />p1->getdata();<br />p1->putdata();<br />getch();<br />}<br />15: HYBRID INHARITANCE: <br /># include<iostream.h><br /># include<conio.h><br />class grandfather<br />{<br />private:<br />int a;<br />char n[10];<br />public:<br />void getdata()<br />{<br />cout<<quot; Enter the age of grandfather==>quot; ;<br />cin>>a;<br />cout<<quot; quot; ;<br />cout<<quot; Enter the name of grandfather==>quot; ;<br />cin>>n;<br />cout<<quot; quot; ;<br />}<br />void putdata()<br />{<br />cout<<quot; age of G.Fquot; <<a;<br />cout<<quot; quot; ;<br />cout<<quot; name of G.Fquot; <<n;<br />}<br />};<br />class father:public grandfather<br />{<br />private:<br />char a[10];<br />public:<br />void getdata1()<br />{<br />getdata();<br />cout<<quot; Enter the name of fatherquot; ;<br />cin>>a;<br />}<br />void putdata1()<br />{<br />putdata();<br />cout<<quot; the name of father isquot; <<a;<br />}<br />};<br />class mother:public grandfather<br />{<br />private:<br />int p;<br />public:<br />void getdata2()<br />{<br />getdata();<br />cout<<quot; Enter the phone no of motherquot; ;<br />cin>>p;<br />}<br />void putdata2()<br />{<br />putdata();<br />cout<<quot; the phone no of mother isquot; <<p;<br />}<br />};<br />class son:public father,mother<br />{<br />private:<br />char m[10];<br />public:<br />void getdata3()<br />{<br />getdata1();<br />getdata2();<br />cout<<quot; Enter the marks of sonquot; ;<br />cin>>m;<br />cout<<quot; quot; ;<br />}<br />void putdata3()<br />{<br />putdata1();<br />putdata2();<br />cout<<quot; The marks of son isquot; <<m;<br />}<br />};<br />void main()<br />{<br />son s;<br />clrscr();<br />s.getdata3();<br />s.putdata3();<br />getch();<br />}<br />15: MULTIPAL INHARITANCE: <br /># include<iostream.h><br />#include<conio.h><br />class father<br />{<br />private:<br />int a;<br />char n[10];<br />public:<br />void getdata()<br />{<br />cout<<quot; enter the name of father==>quot; ;<br />cin>>a;<br />cout<<quot; quot; ;<br />cout<<quot; enter the age of father==>quot; ;<br />cin>>n;<br />cout<<quot; quot; ;<br />}<br />void putdata()<br />{<br />cout<<quot; name of fatherquot; <<n;<br />cout<<quot; age of fatherquot; <<a;<br />}<br />};<br />class son: public father<br />{<br />private:<br />int p;<br />char n[10];<br />public:<br />void getdata1()<br />{<br />getdata();<br />cout<<quot; enter phone of son==>quot; ;<br />cin>>p;<br />cout<<quot; enter name of son==>quot; ;<br />cin>>n;<br />}<br />void putdata1()<br />{<br />putdata();<br />cout<<quot; the phonequot; <<p;<br />cout<<quot; name isquot; <<n;<br />}<br />};<br />void main()<br />{<br />son s;<br />clrscr();<br />s.putdata1();<br />s.getdata1();<br />getch();<br />}<br />16: BANK:<br /># include<iostream.h><br /># include<conio.h><br />class bank<br />{<br />private:<br />char n;<br />public:<br />void getdata()<br />{<br />cout<<quot; enter the name of bankquot; ;<br />cin>>n;<br />cout<<quot; quot; ;<br />}<br />void putdata()<br />{<br />cout<<quot; enter the name of bankquot; ;<br />cin>>n;<br />cout<<quot; quot; ;<br />}<br />};<br />class manager<br />{<br />private:<br />char n[20];<br />int a;<br />public:<br />void getdata1()<br />{<br />cout<<quot; enter the namequot; ;<br />cin>>n;<br />cout<<quot; quot; ;<br />cout<<quot; enter the agequot; ;<br />cin>>a;<br />cout<<quot; quot; ;<br />}<br />void putdata1()<br />{<br />cout<<quot; enter the name and agequot; <<n<<a;<br />}<br />};<br />class coustmer: public bank,manager<br />{<br />private:<br />int p;<br />public:<br />void getdata2()<br />{<br />getdata();<br />getdata1();<br />cout<<quot; enter the phonequot; ;<br />cin>>p;<br />}<br />void putdata2()<br />{<br />putdata();<br />putdata1();<br />cout<<quot; the phone isquot; <<p;<br />}<br />};<br />void main()<br />{<br />coustmer c;<br />clrscr();<br />c.getdata2();<br />c.putdata2();<br />getch();<br />}<br />18: CLASS TRAIN:<br />#include<iostream.h><br />#include<conio.h><br />class train<br />{<br />private:<br />int b;<br />int tn;<br />char s[20];<br />char d[20];<br />float l;<br />public:<br />train()<br />{<br />tn=479;<br />s=quot; dehliquot; ;<br />d=quot; chdquot; ;<br />l=52.95;<br />b=70;<br />}<br />void putdata()<br />{<br />cout<<quot; the train no,source,destination and load copestequot; <<tn<<s<<d<<l;<br />}<br />};<br />void main()<br />{<br />train.t;<br />t.putdata();<br />getch();<br />}<br />19: SIMPLE IHARITANCE (WITH TEACHER EXAMPLE)<br /># include<iostream.h><br /># include<conio.h><br />class teacher<br />{<br />private:<br />int a;<br />char n[10];<br />float i;<br />public:<br />void manny()<br />{<br />cout<<quot; Enter the name of teacher==>quot; ;<br />cin>>n;<br />cout<<quot; Enter the age of teacher==>quot; ;<br />cin>>a;<br />cout<<quot; Enter the income of teacher==>quot; ;<br />cin>>i;<br />}<br />void verma()<br />{<br />cout<<quot; Name of teacher is==>quot; <<n<<endl;<br />cout<<quot; quot; ;<br />cout<<quot; Age of teacher is==>quot; <<a<<endl;<br />cout<<quot; quot; ;<br />cout<<quot; Income of teacher is==>quot; <<i<<endl;<br />}<br />};<br />void main()<br />{<br />clrscr();<br />teacher t;<br />t.manny();<br />t.verma();<br />getch();<br />}<br />20: HOSPITAL INHARITANCE:<br />#include<iostream.h><br />#include<conio.h><br />class hospital<br />{<br />private:<br />char n[10];<br />int h;<br />public:<br />void getdata()<br />{<br />cout<<quot; Enter the name of hospital==>quot; ;<br />cin>>n;<br />cout<<quot; quot; ;<br />cout<<quot; Enter the height==>quot; ;<br />cin>>h;<br />}<br />void putdata()<br />{<br />cout<<quot; quot; ;<br />cout<<quot; Name of hospital==>quot; <<n;<br />cout<<quot; quot; ;<br />cout<<quot; Height of hospital==>quot; <<h;<br />}<br />};<br />class doctor: public hospital<br />{<br />private:<br />int a;<br />char n[10];<br />public:<br />void getdata1()<br />{<br />getdata();<br />cout<<quot; quot; ;<br />cout<<quot; enter the age of doctor==>quot; ;<br />cin>>a;<br />cout<<quot; quot; ;<br />cout<<quot; enter the name of doctor==>quot; ;<br />cin>>n;<br />cout<<quot; quot; ;<br />}<br />void putdata1()<br />{<br />putdata();<br />cout<<quot; age of doctor==>quot; <<a;<br />cout<<quot; name of doctor==>quot; <<n;<br />}<br />};<br />void main()<br />{<br />doctor s;<br />s.getdata1();<br />s.putdata1();<br />getch();<br />}<br />Our project on punjab electricity bill calculater :<br /># include<iostream.h><br /># include<conio.h><br />void main()<br />{<br />int a;<br />long float cr,pr,u;<br />long float u0=2.40,u1=4.357,u2=3.91;<br />clrscr();<br />cout<<quot; quot; ;<br />cout<<quot; ****** CREATED BY GROUP A OF P.A.U STUDENT *****quot; ;<br />cout<<quot; quot; ;<br />cout<<quot; SOFTWARE TO CALCULATE YOU ELECTRICITY BILLquot; ;<br />cout<<quot; quot; ;<br />cout<<quot; Enter your current reading from your bill==> quot; ;<br />cin>>cr;<br />cout<<quot; quot; ;<br />cout<<quot; Enter you previous reading==> quot; ;<br />cin>>pr;<br />cout<<quot; quot; ;<br />u=cr-pr;<br />cout<<quot; your used units==> quot; <<u<<endl;<br />cout<<quot; quot; ;<br />if (u<=100)<br />{<br />a=u*u0;<br />}<br />if ((u>100)&&(u<=200))<br />{<br />a=u*u2;<br />}<br />else<br />{<br />a=u*u1;<br />}<br />cout<<quot; -----------quot; ;<br />cout<<quot; your current bill amount is==> quot; <<a;<br />cout<<quot; -----------quot; ;<br />getch();<br />}<br /> **********************<br /> ******************<br /> ***************<br /> ************<br /> <br /> <br />