Posts

Write a C++ program using class to sort an integer array and float array element in ascending order using bubble sort method use function overloading

Write a C++ program using class to sort an integer array and float array element in ascending order using bubble sort method use function overloading #include<stdio.h> #include<conio.h> #include<iostream.h> #include<float.h> class bubble { public:void array(int ans);        void array(float ans); }; void bubble:: array(int ans)        {        cout<<"\n"<<ans;        } void bubble::array(float ans)        {        cout<<"\n"<<ans;        } int main() { bubble bb; int i,j,n,a[20],temp=0; float b[20]; clrscr(); cout<<"\n Enter how many integer number you want to enter:-"; cin>>n; for(i=0;i<n;i++) cin>>a[i]; n=n-1; for(i=0;i<n;i++) { for(j=0;j<n-i;j++) { if(a[j]>a[j+1]) { temp=a[j]; a[j]=a[j+1]; a[j+1]=te...

Write a C++ program to Design a class which contain static data member and member function show()

Design a class which contain static data member and member function show() which display number of times display operation is performed irrespective of the object responsible for display using static data member. #include<conio.h> #include<iostream.h> class number { public:static int cnt; public:static void show()        {        cnt++;        cout<<"\n Number of times display operation is performed:-"<<cnt;        } }; int number::cnt; int main() { number n1,n2,n3,n4; clrscr(); n1.show(); n2.show(); n3.show(); n4.show(); getch(); return 0; } ================================================== OUTPUT Number of times display operation is performed:-1 Number of times display operation is performed:-2 Number of times display operation is performed:-3 Number of times display operation is performed:-4

Write a c++ program using class to calculate cube and square of a given number using inline function.

Write a c++ program using class to calculate cube and square of a given number using inline function. #include<iostream.h> #include<conio.h> class calc { int no; public:inline void number()        {        int square,cube;        cout<<"Enter the number";        cin>>no;        square=no*no;        cube=no*no*no;        cout<<"Square of a given number is:-"<<square;        cout<<"\n Cube of a given number is:-"<<cube;        }        }; int main() { calc c; clrscr(); c.number(); getch(); return 0; } ====================================================== OUTPUT:- Enter the number5 Square of a given number is:-25 Cube of a given number is:-...

Write a c++ program using class to overload the operator unary decrement -- for an integer number.

Write a c++ program using class to overload the operator unary decrement -- for an integer number. #include<conio.h> #include<iostream.h> class decrement { public:int no; public:void getdata()        {        cout<<"\n Enter the number:-";        cin>>no;        }        void operator --()        {        no=no-1;        }        void display()        {        cout<<"\n The number after decrement is:-"<<no;        } }; int main() { decrement i; clrscr(); i.getdata(); --i; i.display(); getch(); return 0; } ================================================== OUTPUT Enter the number:-6 T...

Write a c++ program using class to overload the operator unary increment ++ for an integer number.

Write a c++ program using class to overload the operator unary increment ++ for an integer number. #include<conio.h> #include<iostream.h> class increment { public:int no; public:void getdata()        {        cout<<"\n Enter the number:-";        cin>>no;        }        void operator ++()        {        no=no+1;        }        void display()        {        cout<<"\n The number after increment is:-"<<no;        } }; int main() { increment i; clrscr(); i.getdata(); ++i; i.display(); getch(); return 0; } ========================================= OUTPUT Enter the number:-2 The number after...

VB program to dispaly age from birth date

Image
Design Window:- Code: Private Sub cmdClear_Click()     Text1.Text = ""     Text2.Text = ""     Text1.SetFocus End Sub Private Sub cmdDisplay_Click()     Dim b As Date     Dim d As Date     Dim age As Date     b = Text1.Text     d = Format$(Now, "dd/mm/yyyy hh:mm:ss ")     age = Format$(d - b, "dd/mm/yyyy hh:mm:ss")         Text2.Text = Year(age)     Text3.Text = Month(age)     Text4.Text = Day(age)     Text5.Text = Hour(age)     Text6.Text = Minute(age)     Text7.Text = Second(age) End Sub Private Sub cmdExit_Click()     Unload Me End Sub =================================================== OUTPUT

Write a c++ program using class to read the name of user and number of units consumed and printout charges with name(Electricity)

An electricity board charges the following rates to users -for first 100 units:40p per unit -for next 200 units: 50p per unit -for beyond 300 units :60p per unit all user are charged a minimum of Rs.150. if the total cost is more than Rs.250 then an additional charges of 15% are added. write a c++ program using class to read the name of user and number of units consumed and printout charges with names.(use array of object) #include<conio.h> #include<iostream.h> class elec { char name[20]; int nou; float charge; public:void accept()        {        cout<<"\n enter name:-";        cin>>name;        cout<<"\n enter number of unit:-";        cin>>nou;        }        void calc()        { ...