Wednesday, July 29, 2009

Bubble Sort

Problem:
Write a C++ program that will ask the user to enter not greater than to 15 numbers
(decimal numbers are accepted)
. And
Sort the 15 inputs(ascending).


#include
#include
#include

using namespace std;

float a[15];

main()
{

system("cls");
char choice,c;
int cnt,temp2,cnt1;

cout<<"Enter 15 numbers: "; for(cnt=1;cnt<=15;cnt++) { cin>>a[cnt];
}


cout<<"Sort values are: "; for(cnt=1;cnt<=15;cnt++) { for(cnt1=1;cnt1<=15;cnt1++) { if(a[cnt]<= 15; cnt++) { cout <<>
m. "; cin>>c;
if(c == 'Y' || c == 'y')
{
return main();
}
else if (c == 'N' || c == 'n') {
return 0;}

getch();

}



Output:



5 comments:

KyleX said...

kevz! after 1 yr pa ka nka post ba? grabe! hehe

Kevin said...

awww.....

dugay nmn ko nag buhat g tamd mn gud ko sa una...hehehe,,,pewo krn e try nako na e update akng blog...nyahahahah....

KyleX said...

i always ni update! ejjeej!

Kevin said...

lage e update ko nimo always kng ala koy lingaw....

heheheheh,,

@__@

KyleX said...

unsang kung wla kay lingaw? dpat maskin naa kay lingaw iiupdate? ibutang imu kalagot dri sa OSAD!! haha! nawala naman gud 2ng blog nko na naay kalagot..hehe!