0% found this document useful (0 votes)
21 views2 pages

Oop Practical5.1

Uploaded by

Rishu Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Oop Practical5.1

Uploaded by

Rishu Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 2

INPUT:

//Practical-5 by Yashada Ajit Tembe


//SE-C Roll no. 53

#include<iostream>
using namespace std;
int n;
#define size 10
template <class T>
void sel(T A[size])
{
int i,j,min;
T temp;
for(i=0;i<n-1;i++)
{
min=i;
for(j=i+1;j<n;j++)
{
if(A[j]<A[min])
min=j;
}
temp=A[i];
A[i]=A[min];
A[min]=temp;
}
cout<<"\nSorted Array: ";
for(i=0;i<n;i++)
{
cout<<" "<<A[i];
}
}
int main()
{
int A[size];
float B[size];
int i;
cout<<"\nEnter total no. of int elements: ";
cin>>n;
cout<<"\nEnter int elements: ";
for(i=0;i<n;i++)
{
cin>>A[i];
}
sel(A);
cout<<"\nEnter total no. of float elements: ";
cin>>n;
cout<<"\nEnter float elements: ";
for(i=0;i<n;i++)
{
cin>>B[i];
}
sel(B);
}

OUTPUT:

You might also like