SlideShare una empresa de Scribd logo
1 de 42
/*Program to declare class Account having data members as Account No.
and balance. Accept this data for 3 accounts and give interest of 10% where
balance is equal or greater than 5000 and display them*/
#include<iostream.h>
#include<conio.h>
class Account
{
public:
int acc_no,bal,inte;
void accept();
void display();
};
void Account::accept(void)
{
cout<<"tEnter the account number : ";
cin>>acc_no;
cout<<"tEnter the balance : ";
cin>>bal;
}
void Account::display(void)
{
cout<<"tThe account number is : "<<acc_no<<endl;
cout<<"tThe balance is : "<<bal<<endl;
}
void main()
{
int i;
clrscr();
Account a[3];
for(i=0;i<3;i++)
{
a[i].accept();
}
cout<<"*********************************************"<<endl;
for(i=0;i<3;i++)
{
if(a[i].bal>=5000)
{
a[i].inte=(a[i].bal*100)/10;
a[i].bal=a[i].bal+a[i].inte;
}
a[i].display();
cout<<"=============================================="<<endl;
}
getch();
}
OUTPUT
/*Program to declare a class city having data members as name and
population.Accept this data for 5 cities and display names of city
having highest population*/
#include<iostream.h>
#include<conio.h>
class city
{
public:
char name[20];
int population;
void accept()
{
cout<<"tEnter the Name of the city: ";
cin>>name;
cout<<"tEnter the population : ";
cin>>population;
}
void display()
{
cout<<"tName is : "<<name<<endl;
cout<<"tPopulation is : "<<population<<endl;
}
};
void main()
{
int i;
clrscr();
city c[5];
for(i=0;i<5;i++)
{
c[i].accept();
}
//sorting
for(i=0;i<5;i++)
{
for(int j=0;j<4;j++)
{
if(c[j].population<c[j+1].population)
{
city temp = c[j];
c[j]=c[j+1];
c[j+1]=temp;
}
}
}
for(i=0;i<5;i++)
{
c[i].display();
}
getch();
}
OUTPUT
/*Program for swapping contents using friend function*/
#include<iostream.h>
#include<conio.h>
class sample
{
private:
int x,y;
public:
void setdata(int a,int b)
{
x=a;
y=b;
}
void showdata()
{
cout<<"nnttx="<<x<<"nntty="<<y;
}
friend void swap(sample &s);
};
void swap(sample &s)
{
int temp;
temp=s.x;
s.x=s.y;
s.y=temp;
}
void main()
{
sample s;
int x1,x2;
clrscr();
cout<<"nnttEnter 2 Numbers:";
cin>>x1>>x2;
s.setdata(x1,x2);
cout<<"nnttBefore Swappingn";
s.showdata();
cout<<"nnttAfter Swappingn";
swap(s);
s.showdata();
getch();
}
OUTPUT
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
class emp
{
public:
int emp_no,sal;
char ch;
void accept()
{
cout<<"nnttEnter the number : ";
cin>>emp_no;
cout<<"nnttEnter the salary : ";
cin>>sal;
}
void display()
{
cout<<"nnttEnter another(Y/N) ? : ";
// cin>>ch;
}
};
void main()
{
char ch;
emp e,e1;
clrscr();
e.accept();
e.display();
// cout<<"Enter u r choice Y|N : ";
cin>>ch;
if(ch=='y' || ch=='Y')
{
e.accept();
e1.accept();
}
else
{
cout<<"nnttExit";
}
getch();
}
OUTPUT :
/**/
#include<iostream.h>
#include<conio.h>
class sample
{
static int r;
int p,d,i;
public:
void accept();
void display();
};
int sample::r;
void sample::accept()
{
cout<<"nnttEnter principal : ";
cin>>p;
cout<<"nnttEnter the rate of interest : ";
cin>>r;
cout<<"nnttEnter the duration : ";
cin>>d;
}
void sample::display()
{
i=p*d*r/100;
cout<<"nnttSimple Interest : "<<i;
}
void main()
{
clrscr();
sample s;
s.accept();
s.display();
getch();
}
OUTPUT :
#include<iostream.h>
#include<conio.h>
class base1
{
private:
int b1;
};
class base2
{
private:
int b2;
};
class derived:public base1,public base2
{
private:
int d1;
};
void main()
{
clrscr();
cout<<endl<<"nntt"<<sizeof(base1)<<endl<<"nntt"
<<sizeof(base2)<<endl<<"nntt"<<sizeof(derived);
getch();
}
OUTPUT:
/*Program to implement multiple inheritance. Assume suitable
member variables and member functions(using virtual base class*/
#include<iostream.h>
#include<conio.h>
class acc
{
private:
char name[20];
public:
void accept1()
{
cout<<"nnttEnter the name : ";
cin>>name;
}
void display1()
{
cout<<"nnttThe name is : "<<name;
}
};
class sav_a:virtual public acc
{
private:
int no;
public:
void accept2()
{
cout<<"nnttEnter the number : ";
cin>>no;
}
void display2()
{
cout<<"nnttThe number is : "<<no;
}
};
class cur_a:public virtual acc
{
private:
int a_no;
public:
void accept3()
{
cout<<"nnttEnter the a_no number : ";
cin>>a_no;
}
void display3()
{
cout<<"nnttThe a_no is : "<<a_no;
}
};
class fix_dip:public sav_a,public cur_a
{
private:
int rec_no;
public:
void accept4()
{
cout<<"nnttEnter rec number : ";
cin>>rec_no;
}
void display4()
{
cout<<"nnttThe rec number is : "<<rec_no;
}
};
void main()
{
clrscr();
fix_dip f;
f.accept1();
f.display1();
f.accept2();
f.display2();
f.accept3();
f.display3();
f.accept4();
f.display4();
getch();
}
OUTPUT :
/*Hierachical Inheriance*/
#include<iostream.h>
#include<conio.h>
class Employee
{
private:
char emp_nm[23];
int emp_id;
public:
void accept1()
{
cout<<"nnttEnter the Employee name : ";
cin>>emp_nm;
cout<<"nnttEnter the employee ID : ";
cin>>emp_id;
}
void display1()
{
cout<<"nnttThe employee Name is : "<<emp_nm;
Employee
ManagerWorker
cout<<"nnttThe employee ID is : "<<emp_id;
}
};
class worker:public Employee
{
private:
int sal;
public:
void accept2()
{
cout<<"nnttEnter the salary : ";
cin>>sal;
}
void display2()
{
cout<<"nnttThe salary is : "<<sal;
}
};
class Manager:public Employee
{
private:
int allowance;
public:
void accept3()
{
cout<<"nnttEnter the total allowance : ";
cin>>allowance;
}
void display3()
{
cout<<"nnttThe total allowance is : "<<allowance;
}
};
void main()
{
clrscr();
worker w;
w.accept1();
w.display1();
w.accept2();
w.display2();
Manager m;
m.accept1();
m.display1();
m.accept3();
m.display3();
getch();
}
OUTPUT :
/*Program to declare a class book containing data members
book_title,author_name and price. Accept and display the
information for one object of the class using pointer to that
object.*/
#include<iostream.h>
#include<conio.h>
class book
{
int price;
char title[14],name[20];
public:
void getdata()
{
cout<<"nnttEnter the title of the Book : ";
cin>>title;
cout<<"nnttEnter the name of the Author :
";
cin>>name;
cout<<"nnttEnter the price of the Book : ";
cin>>price;
}
void putdata()
{
cout<<"nnttThe title of the Book is :
"<<title;
cout<<"nnttThe name of the Book is :
"<<name;
cout<<"nnttThe price of the Book is :
"<<price;
}
};
void main()
{
book b,*p;
clrscr();
p=&b;
p->getdata();
p->putdata();
getch();
}
OUTPUT 
/*Program to declare a class ‘box’ having data members
height,width and breadth.Accept this information for one
object using pointer to that object. Display the area and
volume of that object.*/
#include<iostream.h>
#include<conio.h>
class box
{
int height,width,breadth;
public:
void getdata()
{
cout<<"nnttEnter the height : ";
cin>>height;
cout<<"nnttEnter the width : ";
cin>>width;
cout<<"nnttEnter the breadth : ";
cin>>breadth;
}
void area()
{
cout<<"nnttArea of the box is :
"<<breadth*width;
}
void volume()
{
cout<<"nnttVolume of the Box is :
"<<height*width*breadth;
}
};
void main()
{
clrscr();
box b,*p;
p=&b;
p->getdata();
p->area();
p->volume();
getch();
}
OUTPUT :  
/*program to declare a class birthday having data members day, month
and year. Accept this information for 4 object using pointer to the
array of object.*/
#include<iostream.h>
#include<conio.h>
class birthday
{
private:
int day,month,year;
public:
void getdata()
{
cout<<"ntEnter the Day : ";
cin>>day;
cout<<"ntEnter the Month : ";
cin>>month;
cout<<"ntEnter the Year : ";
cin>>year;
}
};
void main()
{
int i;
clrscr();
birthday *b[4];
for(i=0;i<4;i++)
{
b[i]->getdata();
}
getch();
}
OUTPUT 
Pratik Bakane C++
Pratik Bakane C++
Pratik Bakane C++
Pratik Bakane C++

Más contenido relacionado

La actualidad más candente

basic programs in C++
basic programs in C++ basic programs in C++
basic programs in C++
Arun Nair
 
Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)
Syed Umair
 
Travel management
Travel managementTravel management
Travel management
1Parimal2
 

La actualidad más candente (20)

C++ Programming - 3rd Study
C++ Programming - 3rd StudyC++ Programming - 3rd Study
C++ Programming - 3rd Study
 
Cpp tutorial
Cpp tutorialCpp tutorial
Cpp tutorial
 
C++ Question on References and Function Overloading
C++ Question on References and Function OverloadingC++ Question on References and Function Overloading
C++ Question on References and Function Overloading
 
Stl algorithm-Basic types
Stl algorithm-Basic typesStl algorithm-Basic types
Stl algorithm-Basic types
 
1
11
1
 
Understanding storage class using nm
Understanding storage class using nmUnderstanding storage class using nm
Understanding storage class using nm
 
C++
C++C++
C++
 
Function basics
Function basicsFunction basics
Function basics
 
basic programs in C++
basic programs in C++ basic programs in C++
basic programs in C++
 
Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)Assignement of programming & problem solving ass.(3)
Assignement of programming & problem solving ass.(3)
 
Travel management
Travel managementTravel management
Travel management
 
Pads lab manual final
Pads lab manual finalPads lab manual final
Pads lab manual final
 
งานนำเสนอ อาจารย์ลาวัลย์
งานนำเสนอ อาจารย์ลาวัลย์งานนำเสนอ อาจารย์ลาวัลย์
งานนำเสนอ อาจารย์ลาวัลย์
 
week-10x
week-10xweek-10x
week-10x
 
week-11x
week-11xweek-11x
week-11x
 
week-18x
week-18xweek-18x
week-18x
 
Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3
 
week-1x
week-1xweek-1x
week-1x
 
C++ assignment
C++ assignmentC++ assignment
C++ assignment
 
C program to implement linked list using array abstract data type
C program to implement linked list using array abstract data typeC program to implement linked list using array abstract data type
C program to implement linked list using array abstract data type
 

Destacado

Write a program to print out all armstrong numbers between 1 and 500
Write a program to print out all armstrong numbers between 1 and 500Write a program to print out all armstrong numbers between 1 and 500
Write a program to print out all armstrong numbers between 1 and 500
ilsamaryum
 
02 c++ Array Pointer
02 c++ Array Pointer02 c++ Array Pointer
02 c++ Array Pointer
Tareq Hasan
 

Destacado (18)

Object Oriented Programming Lab Manual
Object Oriented Programming Lab Manual Object Oriented Programming Lab Manual
Object Oriented Programming Lab Manual
 
Programs of C++
Programs of C++Programs of C++
Programs of C++
 
Doubly linklist
Doubly linklistDoubly linklist
Doubly linklist
 
Computer graphics programs in c++
Computer graphics programs in c++Computer graphics programs in c++
Computer graphics programs in c++
 
Write a program to print out all armstrong numbers between 1 and 500
Write a program to print out all armstrong numbers between 1 and 500Write a program to print out all armstrong numbers between 1 and 500
Write a program to print out all armstrong numbers between 1 and 500
 
Loops
LoopsLoops
Loops
 
C++ programming
C++ programmingC++ programming
C++ programming
 
Pointers & References in C++
Pointers & References in C++Pointers & References in C++
Pointers & References in C++
 
intro to pointer C++
intro to  pointer C++intro to  pointer C++
intro to pointer C++
 
microprocessor & programming
 microprocessor & programming microprocessor & programming
microprocessor & programming
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
 
Pointer in c++ part1
Pointer in c++ part1Pointer in c++ part1
Pointer in c++ part1
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
 
C++ Pointers
C++ PointersC++ Pointers
C++ Pointers
 
02 c++ Array Pointer
02 c++ Array Pointer02 c++ Array Pointer
02 c++ Array Pointer
 
Flowchart
FlowchartFlowchart
Flowchart
 
Black Book Project Report on Digital India
Black Book Project  Report on Digital IndiaBlack Book Project  Report on Digital India
Black Book Project Report on Digital India
 
C++ programming
C++ programmingC++ programming
C++ programming
 

Similar a Pratik Bakane C++

Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd march
Rajeev Sharan
 
So I already have most of the code and now I have to1. create an .pdf
So I already have most of the code and now I have to1. create an .pdfSo I already have most of the code and now I have to1. create an .pdf
So I already have most of the code and now I have to1. create an .pdf
arjuncollection
 
c++ program for Railway reservation
c++ program for Railway reservationc++ program for Railway reservation
c++ program for Railway reservation
Swarup Kumar Boro
 
C++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptxC++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptx
ssuser3cbb4c
 
Oops practical file
Oops practical fileOops practical file
Oops practical file
Ankit Dixit
 
This what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdfThis what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdf
kavithaarp
 

Similar a Pratik Bakane C++ (20)

Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd march
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
 
C++ file
C++ fileC++ file
C++ file
 
C++ file
C++ fileC++ file
C++ file
 
c++ practical Digvajiya collage Rajnandgaon
c++ practical  Digvajiya collage Rajnandgaonc++ practical  Digvajiya collage Rajnandgaon
c++ practical Digvajiya collage Rajnandgaon
 
Statement
StatementStatement
Statement
 
C++ coding for Banking System program
C++ coding for Banking System programC++ coding for Banking System program
C++ coding for Banking System program
 
So I already have most of the code and now I have to1. create an .pdf
So I already have most of the code and now I have to1. create an .pdfSo I already have most of the code and now I have to1. create an .pdf
So I already have most of the code and now I have to1. create an .pdf
 
Oop1
Oop1Oop1
Oop1
 
Computer Programming- Lecture 10
Computer Programming- Lecture 10Computer Programming- Lecture 10
Computer Programming- Lecture 10
 
oop Lecture 4
oop Lecture 4oop Lecture 4
oop Lecture 4
 
Railwaynew
RailwaynewRailwaynew
Railwaynew
 
c++ program for Railway reservation
c++ program for Railway reservationc++ program for Railway reservation
c++ program for Railway reservation
 
Railway reservation
Railway reservationRailway reservation
Railway reservation
 
C++ in 10 Hours.pdf.pdf
C++ in 10 Hours.pdf.pdfC++ in 10 Hours.pdf.pdf
C++ in 10 Hours.pdf.pdf
 
C++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptxC++ lectures all chapters in one slide.pptx
C++ lectures all chapters in one slide.pptx
 
Oops practical file
Oops practical fileOops practical file
Oops practical file
 
This what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdfThis what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdf
 
Kirti Kumawat, BCA Third Year
Kirti Kumawat, BCA Third YearKirti Kumawat, BCA Third Year
Kirti Kumawat, BCA Third Year
 
Cs pritical file
Cs pritical fileCs pritical file
Cs pritical file
 

Último

notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 

Pratik Bakane C++

  • 1. /*Program to declare class Account having data members as Account No. and balance. Accept this data for 3 accounts and give interest of 10% where balance is equal or greater than 5000 and display them*/ #include<iostream.h> #include<conio.h> class Account { public: int acc_no,bal,inte; void accept(); void display(); }; void Account::accept(void) { cout<<"tEnter the account number : "; cin>>acc_no; cout<<"tEnter the balance : "; cin>>bal; } void Account::display(void) {
  • 2. cout<<"tThe account number is : "<<acc_no<<endl; cout<<"tThe balance is : "<<bal<<endl; } void main() { int i; clrscr(); Account a[3]; for(i=0;i<3;i++) { a[i].accept(); } cout<<"*********************************************"<<endl; for(i=0;i<3;i++) { if(a[i].bal>=5000) { a[i].inte=(a[i].bal*100)/10;
  • 5. /*Program to declare a class city having data members as name and population.Accept this data for 5 cities and display names of city having highest population*/ #include<iostream.h> #include<conio.h> class city { public: char name[20]; int population; void accept() { cout<<"tEnter the Name of the city: "; cin>>name; cout<<"tEnter the population : "; cin>>population; } void display() { cout<<"tName is : "<<name<<endl;
  • 6. cout<<"tPopulation is : "<<population<<endl; } }; void main() { int i; clrscr(); city c[5]; for(i=0;i<5;i++) { c[i].accept(); } //sorting for(i=0;i<5;i++) { for(int j=0;j<4;j++) { if(c[j].population<c[j+1].population) { city temp = c[j];
  • 9. /*Program for swapping contents using friend function*/ #include<iostream.h> #include<conio.h> class sample { private: int x,y; public: void setdata(int a,int b) { x=a; y=b; } void showdata() { cout<<"nnttx="<<x<<"nntty="<<y; } friend void swap(sample &s); }; void swap(sample &s) { int temp; temp=s.x;
  • 10. s.x=s.y; s.y=temp; } void main() { sample s; int x1,x2; clrscr(); cout<<"nnttEnter 2 Numbers:"; cin>>x1>>x2; s.setdata(x1,x2); cout<<"nnttBefore Swappingn"; s.showdata(); cout<<"nnttAfter Swappingn"; swap(s); s.showdata(); getch(); }
  • 12. #include<iostream.h> #include<conio.h> #include<string.h> #include<stdlib.h> class emp { public: int emp_no,sal; char ch; void accept() { cout<<"nnttEnter the number : "; cin>>emp_no; cout<<"nnttEnter the salary : "; cin>>sal; } void display() { cout<<"nnttEnter another(Y/N) ? : "; // cin>>ch; } };
  • 13. void main() { char ch; emp e,e1; clrscr(); e.accept(); e.display(); // cout<<"Enter u r choice Y|N : "; cin>>ch; if(ch=='y' || ch=='Y') { e.accept(); e1.accept(); } else { cout<<"nnttExit"; } getch(); }
  • 15. /**/ #include<iostream.h> #include<conio.h> class sample { static int r; int p,d,i; public: void accept(); void display(); }; int sample::r; void sample::accept() { cout<<"nnttEnter principal : "; cin>>p; cout<<"nnttEnter the rate of interest : "; cin>>r; cout<<"nnttEnter the duration : "; cin>>d; }
  • 16. void sample::display() { i=p*d*r/100; cout<<"nnttSimple Interest : "<<i; } void main() { clrscr(); sample s; s.accept(); s.display(); getch(); }
  • 18. #include<iostream.h> #include<conio.h> class base1 { private: int b1; }; class base2 { private: int b2; }; class derived:public base1,public base2 { private: int d1; }; void main() { clrscr(); cout<<endl<<"nntt"<<sizeof(base1)<<endl<<"nntt" <<sizeof(base2)<<endl<<"nntt"<<sizeof(derived);
  • 20. /*Program to implement multiple inheritance. Assume suitable member variables and member functions(using virtual base class*/ #include<iostream.h> #include<conio.h> class acc { private: char name[20]; public: void accept1() { cout<<"nnttEnter the name : "; cin>>name; } void display1() { cout<<"nnttThe name is : "<<name; } }; class sav_a:virtual public acc
  • 21. { private: int no; public: void accept2() { cout<<"nnttEnter the number : "; cin>>no; } void display2() { cout<<"nnttThe number is : "<<no; } }; class cur_a:public virtual acc { private: int a_no; public: void accept3() { cout<<"nnttEnter the a_no number : ";
  • 22. cin>>a_no; } void display3() { cout<<"nnttThe a_no is : "<<a_no; } }; class fix_dip:public sav_a,public cur_a { private: int rec_no; public: void accept4() { cout<<"nnttEnter rec number : "; cin>>rec_no; } void display4() { cout<<"nnttThe rec number is : "<<rec_no; } };
  • 25. /*Hierachical Inheriance*/ #include<iostream.h> #include<conio.h> class Employee { private: char emp_nm[23]; int emp_id; public: void accept1() { cout<<"nnttEnter the Employee name : "; cin>>emp_nm; cout<<"nnttEnter the employee ID : "; cin>>emp_id; } void display1() { cout<<"nnttThe employee Name is : "<<emp_nm; Employee ManagerWorker
  • 26. cout<<"nnttThe employee ID is : "<<emp_id; } }; class worker:public Employee { private: int sal; public: void accept2() { cout<<"nnttEnter the salary : "; cin>>sal; } void display2() { cout<<"nnttThe salary is : "<<sal; } }; class Manager:public Employee { private: int allowance; public:
  • 27. void accept3() { cout<<"nnttEnter the total allowance : "; cin>>allowance; } void display3() { cout<<"nnttThe total allowance is : "<<allowance; } }; void main() { clrscr(); worker w; w.accept1(); w.display1(); w.accept2(); w.display2(); Manager m; m.accept1(); m.display1(); m.accept3(); m.display3();
  • 29.
  • 30. /*Program to declare a class book containing data members book_title,author_name and price. Accept and display the information for one object of the class using pointer to that object.*/ #include<iostream.h> #include<conio.h> class book { int price; char title[14],name[20]; public: void getdata() { cout<<"nnttEnter the title of the Book : "; cin>>title; cout<<"nnttEnter the name of the Author : "; cin>>name; cout<<"nnttEnter the price of the Book : "; cin>>price; }
  • 31. void putdata() { cout<<"nnttThe title of the Book is : "<<title; cout<<"nnttThe name of the Book is : "<<name; cout<<"nnttThe price of the Book is : "<<price; } }; void main() { book b,*p; clrscr(); p=&b; p->getdata(); p->putdata(); getch(); }
  • 33. /*Program to declare a class ‘box’ having data members height,width and breadth.Accept this information for one object using pointer to that object. Display the area and volume of that object.*/ #include<iostream.h> #include<conio.h> class box { int height,width,breadth; public: void getdata() { cout<<"nnttEnter the height : "; cin>>height; cout<<"nnttEnter the width : "; cin>>width; cout<<"nnttEnter the breadth : "; cin>>breadth; } void area() {
  • 34. cout<<"nnttArea of the box is : "<<breadth*width; } void volume() { cout<<"nnttVolume of the Box is : "<<height*width*breadth; } }; void main() { clrscr(); box b,*p; p=&b; p->getdata(); p->area(); p->volume(); getch(); }
  • 36. /*program to declare a class birthday having data members day, month and year. Accept this information for 4 object using pointer to the array of object.*/ #include<iostream.h> #include<conio.h> class birthday { private: int day,month,year; public: void getdata() { cout<<"ntEnter the Day : "; cin>>day; cout<<"ntEnter the Month : "; cin>>month; cout<<"ntEnter the Year : "; cin>>year; } }; void main() {