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
padovan string for n natural numbers p(n)=1,p(n)=2,p(n)=3 and use padovan formul to get output 1

Structures A structure is a derived data type. It is a combination of logically related data items. Unlike arrays, which are a collection of such as data types, structures can

Define Pure Virtual Function? Why & when it is used?


Data is required to be fed into the program (input) and sent out of the program (output). Considering the draughtsman using a CAD station, the input is his commands to cause lines/

I have a program for school and I am not understanding why one of the variables gets skipped or the arithmetic operators aren''t having any effect as I have tryed defining it sever

I have a assignment deadline is 11.11.2015 can I get help

write a c program chat illustrates the creation of child process using fork system call. One process finds sum of even series and other process finds sum of odd series.

i have a project in BDD(Binary Decision Diagram).. where i have to use BDD library...i m using cudd package which uses BDD technique...i download cudd package..try to run in vc++ 6

Q-What happens while a function throws an exception which was not specified through an exception specification for this function? A: Unexpected() is called, which, by default, w