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();
Write a function that has four unsigned char parameters, combines the four one-byte integer values into an unsigned integer, and returns the unsigned integer. When the four one
C program to count the words: void CountWords(); void main() { printf("\n\tcount the words and enter string\n\n\n"); Count
What is the difference between = symbol and == symbol? - The = symbol is generally used in mathematical operations. It's used to assign a value to a given variable whereas the
#quGiven the Array class definition in Fig. 11.10-11.11 (pp. 476-479) of the textbook, write a new overloaded operator function for the ‘%’ (modulus) operator (i.e., return an arra
Write a program to calculate e^x using the formula: e^x = 1 + x/1! + x^2/2! + x^3/3! + ...... Allow the user to enter the integer number x, then do the calculation in a loop (for
Given a bool variable isReadable write some statements that assign true to isReadable if the file "topsecret" exists and can be read by the program and assigns false to isR
This task involves char arrays and pointer based string handling. Which we use to make a simple encryption program, using a Caesar Cipher, Write a program that: a. Asks
Read numbers form user and place them in array: Program is to read a group numbers of numbers form user and place them in array type of float and sort them void sort(floa
tel prgm for tis
Do you have any solution on this activity?
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