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
Write a function that computes f(x) for a quadratic polynomial in x, such as the one in assignment 3. Use the function to plot f(x) from -10 to +10.

Normal 0 false false false EN-US X-NONE X-NONE

Task Your task is to write a program, words, that reports information about the number of words read from its standard input. For example, if the file qbf.txtcontains the text th

how to search, display all data and delete data

Object Oriented Programming Paradigm: For OOP, Paradigm is a standard set.  The OOP will help to develop software in modules, which will be integrated later as a full packag

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Operator overloading - c++ program: Write a program in c to define operator overloading. class matrix{                   private :                 int x[2][2];

What is memory allocation? Memory Allocation : It is the method of allocating memory storage to program in such that the program can be run.

Program of file data: FileData::FileData( ffblk& blk ) :     fileName( blk.ff_name ),     fileDate( (blk.ff_fdate >> 5) & 0x000F,               blk.ff_fdate & 0x0001F

Program to draw a circle: int main(void) {    /* request auto detection */    int gdriver = DETECT, gmode, errorcode;    int midx, midy;    int radius = 100;