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

Assignment Help:

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();

}


Related Discussions:- Selection sort - c program

Write a c program to input a floating point number, Step 1 Define the start...

Step 1 Define the start of the program    It should be noted that within C all commands should end in a semi-colon. For most of your programs the definition of a program header as

PROGRAMMING, PROCEDUAL PROGRAMMING INTRODUCTION

PROCEDUAL PROGRAMMING INTRODUCTION

C program to reverse the elements of array, C program to reverse the elemen...

C program to reverse the elements of array: #define rows 3 #define cols 3 void main() {                 int i=0,j=0;                 int arr[rows][cols];

#otto cycle, To get the efficiency of Otto cycle by C/C++.

To get the efficiency of Otto cycle by C/C++.

C program to find vowels , C Program to FIND VOWELS   void main() ...

C Program to FIND VOWELS   void main() {           char str[50];           int ac=0, ec=0, ic=0, oc=0, uc=0;           int i,stln,vc,word=1;           clrscr

Time table, programme for time table in c++

programme for time table in c++

Padovan string, A Padovan string P(n) for a natural number n is defined as:...

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concate program 1 : package test

Pebble merchant, simple coding for pebble merchant..

simple coding for pebble merchant..

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd