Selection sort - c program, C/C++ Programming

Selection sort - C program:

Write a program to define a selection 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. selection sorting"<

                ssort(a,n);

                 }

 }

 

void ssort(int a[100],int n)

 {

  clrscr();

  int i,min,po,j,t;

  for(i=0; i

                {

                min=a[i];

                po=i;

                 for (j=i+1; j

                {

                if (a[j]

                 {

                  min=a[j];

                  po=j;

                 }

                }

                   t=a[po];

                   a[po]=a[i];

                   a[i]=t;

                }

                cout<<" sorted arrays by selection "<<"\n\n";

                for(i=0;i

                cout<

                getch();

}

Posted Date: 10/19/2012 3:10:44 AM | Location : United States







Related Discussions:- Selection sort - c program, Assignment Help, Ask Question on Selection sort - c program, Get Answer, Expert's Help, Selection sort - c program Discussions

Write discussion on Selection sort - c program
Your posts are moderated
Related Questions
Record separation problem Let us assume that a particular database program manages a simple mailing list which consists of one record for each person on the list, and a number of f

what is the purpose of pointer ? what is the syntax? how it works?

write a c++ program to update employee records

em Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ''Content here, content here'', making it look like readable English. Many desktop publis

in this problem u given a board in which some of the elements are placed as shown in diagram below .each element represent a color .fill the other elements in the board such that n

Relationship between an Array and Pointers. Consider the following. int arr[] = {0,1,2,3,4,5,6,7,8,9}; If we write arr , it is considered as the address of the first elem

C Program for STRING ADDRESS #include stdio.h> #include conio.h> #include string.h> void main() {           char *name;           int length;           cha

THIS PROGRAM IS TO COMPARE THE TWO DATES GIVEN BY THE USER #include #include #include struct date  {   int dd;   int mm;   int yy;  }; date compare(date d1,date d2)  {

Write a program to find minimum number of shelves

I need CSGO Wallhack and Human Aimbot Project Description: Need a CSGO hack which can ESP Wallhack and Aimbot realistically. Must be VAC Proof, and ESL proof, as wel