Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Bubble sort C program:
Write a program to define a bubble sort.
void main()
{
clrscr();
int a[100],ch,n;
cout<<"enter the limit for the array : ";
cin>>n;
for (int i=0;i { cout<<"enter element "< cin>>a[i]; } clrscr(); cout<<"1. bubble sorting"< bsort(a,n); } } void bsort(int a[100],int n) { clrscr(); int i,j,ch2,t; cout<<"1. ascending order "< cout<<"2. descending order "< cout<<" your choice : "; cin>>ch2; switch(ch2) { case 1 : for (i=0;i { for (j=0;j { if (a[j] > a[j+1]) { t=a[j+1]; a[j+1]=a[j]; a[j]=t; } } } break; case 2 : for (i=0;i { for (j=0;j { if (a[j] < a[j+1]) { t=a[j+1]; a[j+1]=a[j]; a[j]=t; } } } break; default : cout<<" wrong choice "; } cout<<" sorted arrays by bubble "<<"\n\n"; for (i=0;i { cout< } getch(); }
cout<<"enter element "<
cin>>a[i];
}
cout<<"1. bubble sorting"< bsort(a,n); } } void bsort(int a[100],int n) { clrscr(); int i,j,ch2,t; cout<<"1. ascending order "< cout<<"2. descending order "< cout<<" your choice : "; cin>>ch2; switch(ch2) { case 1 : for (i=0;i { for (j=0;j { if (a[j] > a[j+1]) { t=a[j+1]; a[j+1]=a[j]; a[j]=t; } } } break; case 2 : for (i=0;i { for (j=0;j { if (a[j] < a[j+1]) { t=a[j+1]; a[j+1]=a[j]; a[j]=t; } } } break; default : cout<<" wrong choice "; } cout<<" sorted arrays by bubble "<<"\n\n"; for (i=0;i { cout< } getch(); }
bsort(a,n);
void bsort(int a[100],int n)
int i,j,ch2,t;
cout<<"1. ascending order "< cout<<"2. descending order "< cout<<" your choice : "; cin>>ch2; switch(ch2) { case 1 : for (i=0;i { for (j=0;j { if (a[j] > a[j+1]) { t=a[j+1]; a[j+1]=a[j]; a[j]=t; } } } break; case 2 : for (i=0;i { for (j=0;j { if (a[j] < a[j+1]) { t=a[j+1]; a[j+1]=a[j]; a[j]=t; } } } break; default : cout<<" wrong choice "; } cout<<" sorted arrays by bubble "<<"\n\n"; for (i=0;i { cout< } getch(); }
cout<<"2. descending order "< cout<<" your choice : "; cin>>ch2; switch(ch2) { case 1 : for (i=0;i { for (j=0;j { if (a[j] > a[j+1]) { t=a[j+1]; a[j+1]=a[j]; a[j]=t; } } } break; case 2 : for (i=0;i { for (j=0;j { if (a[j] < a[j+1]) { t=a[j+1]; a[j+1]=a[j]; a[j]=t; } } } break; default : cout<<" wrong choice "; } cout<<" sorted arrays by bubble "<<"\n\n"; for (i=0;i { cout< } getch(); }
cout<<" your choice : ";
cin>>ch2;
switch(ch2)
case 1 : for (i=0;i { for (j=0;j { if (a[j] > a[j+1]) { t=a[j+1]; a[j+1]=a[j]; a[j]=t; } } } break; case 2 : for (i=0;i { for (j=0;j { if (a[j] < a[j+1]) { t=a[j+1]; a[j+1]=a[j]; a[j]=t; } } } break; default : cout<<" wrong choice "; } cout<<" sorted arrays by bubble "<<"\n\n"; for (i=0;i { cout< } getch(); }
for (j=0;j { if (a[j] > a[j+1]) { t=a[j+1]; a[j+1]=a[j]; a[j]=t; } } } break; case 2 : for (i=0;i { for (j=0;j { if (a[j] < a[j+1]) { t=a[j+1]; a[j+1]=a[j]; a[j]=t; } } } break; default : cout<<" wrong choice "; } cout<<" sorted arrays by bubble "<<"\n\n"; for (i=0;i { cout< } getch(); }
if (a[j] > a[j+1])
t=a[j+1];
a[j+1]=a[j];
a[j]=t;
break;
case 2 : for (i=0;i { for (j=0;j { if (a[j] < a[j+1]) { t=a[j+1]; a[j+1]=a[j]; a[j]=t; } } } break; default : cout<<" wrong choice "; } cout<<" sorted arrays by bubble "<<"\n\n"; for (i=0;i { cout< } getch(); }
for (j=0;j { if (a[j] < a[j+1]) { t=a[j+1]; a[j+1]=a[j]; a[j]=t; } } } break; default : cout<<" wrong choice "; } cout<<" sorted arrays by bubble "<<"\n\n"; for (i=0;i { cout< } getch(); }
if (a[j] < a[j+1])
default : cout<<" wrong choice ";
cout<<" sorted arrays by bubble "<<"\n\n";
for (i=0;i { cout< } getch(); }
cout< } getch(); }
getch();
Additional keywords in C++ Class friend virtual inline private public protected const this new delete operator The actual use and expl
how to write c++ for function f(x)= 2x^3 -x^2 +10
Each of the following two procedures defines a method for adding two positive integers in terms of the procedures inc, which increments its argument by 1, and dec, which decrements
How can I handle a constructor that fails?
Project Description: We are aiming to prepare an industry first in the m-commerce world. M-commerce payment processing programmers required Skills required are C Programmi
I want Packet capture analysis Project Description: Need assistance in debugging some packet capture Skills required is C Programming
#queComputers are frequently used in check-writing systems, such as payroll and accounts payable applications. Many stories circulate regarding weekly pay- checks being printed (by
O v e r l o a d i n g U n a r y Op e r a t o r s Us i n g F r i e n d F u n c t i o n cl a ss s i g n { i n t a ,
Money is immutable and is associated with a currency. When two money entities are added or subtracted be sure to consider currency conversion. You must create a money object result
Passing and Returning Objects Objects can be passed to a function and returned back just like normal variables. When an object is passed by content, the compiler makes another
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd