New Member FAQ
|
Forums
|
Earn Revenue
Resources
Entrance
Ask Experts
Exam Papers
Jobs
English
Projects
Universities
Colleges
Courses
Schools
Training
My India
Members
|
Communities
|
Business Directory
|
Classifieds
|
Reviews
|
Silverlight Games
|
Peer Appraisal
|
Bookmarks
|
Polls
|
Mentors
|
Links
|
MCA Projects
|
Lobby
|
Gift Shop
|
Chat
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
jayesh
(120)
PROSENJIT MANN...
(112)
vinayak
(108)
Last 7 Days
Shobha Manasa
(1586)
Aira
(1346)
PROSENJIT MANN...
(1256)
more...
Awards & Gifts
Online Exams
Aptitude Questions
General Aptitude Tests
Medical Entrance
Engineering Entrance
Bank Tests
TOEFL & IELTS Questions
Fresher Jobs
Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi
Resources
Find educational articles, blogs, discussion threads and other resources.
Colleges
Find details about any college in India or search for courses.
Program to short the array using the bubble sort in c
Posted Date: Total Responses:
0
Posted By:
R.K. GURU
Member Level:
Silver
Points/Cash
: 5
//Developed by R.K.Gour
#include
#include
#include
void bubble_sorti(int[],int); //function prototype
void bubble_sortd(int[],int); //function prototype
void main()
{
int a[20],i,n,index,ch;
char b;
clrscr();
a:
cout<<"\n\n\t\t****MENU****";
cout<<"\n1.TO SORT THE ARRAY IN ASCENDING ORDER";
cout<<"\n2.TO SORT THE ARRAY IN DESCENDING ORDER";
cout<<"\n3.EXIT";
cout<<"\n\nENTER YOUR CHOICE ";
cin>>ch;
switch(ch)
{
case 1:cout<<"\n\nENTER THE NUMBER OF ELEMENTS (MAXIMUM 20)::";
cin>>n;
cout<<"\nENTER THE ARRAY ELEMENTS \n";
for(i=0;i
{
cin>>a[i];
}
bubble_sorti(a,n); //function calling
cout<<"\n\nTHE SORTED ARRAY IS SHOWN AS:: ";
for(i=0;i
{
cout<
}
break;
case 2:cout<<"\n\nENTER THE NUMBER OF ELEMENTS (MAXIMUM 20)::";
cin>>n;
cout<<"\nENTER THE ARRAY ELEMENTS \n";
for(i=0;i
{
cin>>a[i];
}
bubble_sortd(a,n);
cout<<"\n\nTHE SORTED ARRAY IS SHOWN AS:: ";
for(i=0;i
{
cout<
}
break;
case 3:exit(0);
break;
default :cout<<"\nWRONG CHOICE";
cout<<"\nDO YOU WANT TO CONTINUE, ENTER (Y/N):";
cin>>b;
if(b=='y'||b=='Y')
goto a;
break;
}
getch();
}
//***************************************************************
void bubble_sorti(int a[],int size) //function definition
{
getch();
clrscr();
int temp,ctr=0;
for(int i=0;i
{
for(int j=0;j<(size-1)-i;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
cout<<"\nTHE ARRAY AFTER THE ITERATION :"<<++ctr<<" IS ::";
for(int k=0;k
{
cout<
}
}
}
}
void bubble_sortd(int a[],int size) //function definition
{
getch();
clrscr();
int temp,ctr=0;
for(int i=0;i
{
for(int j=0;j<(size-1)-i;j++)
{
if(a[j]
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
cout<<"\nTHE ARRAY AFTER THE ITERATION :"<<++ctr<<" IS ::";
for(int k=0;k
{
cout<
}
}
}
}
//**************************************************************************
Project Feedbacks
No feedbacks found. Be the first to respond and make money from
revenue sharing program
.
Post Feedback
You must
Sign In
to post a feedback.
Next Project:
Screen Programming Project - SAP
Previous Project:
Using System Fields along with Case Statements
Return to Project Index
Post New Project
Related Projects
C Language Program For Multiplication Of Two Matrices
LRU program
Assembly Chain Scheduling in C++
Program to show destruction WTC in graphics mode in 'C'
PROGRAM TO FIND THE ROOTS OF EQ. ax^2 + bx + c = 0 .
Advertise Here
Contact Us
Advertise
Editors
Privacy Policy
Terms Of Use
ISC Technologies.
2006 - 2009 All Rights Reserved.