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