0% found this document useful (0 votes)
8 views1 page

Dummy Program for Sorting Numbers

The document contains a C++ program that implements a sorting class to sort an array of numbers in ascending order. It includes methods for data input, processing the sorting using a bubble sort algorithm, and displaying the sorted numbers. The program has some issues, such as incorrect loop conditions and the use of deprecated headers.

Uploaded by

Avadhoot Matkar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Dummy Program for Sorting Numbers

The document contains a C++ program that implements a sorting class to sort an array of numbers in ascending order. It includes methods for data input, processing the sorting using a bubble sort algorithm, and displaying the sorted numbers. The program has some issues, such as incorrect loop conditions and the use of deprecated headers.

Uploaded by

Avadhoot Matkar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

#include<iostream.

h>
#include<conio.h>
class sort
{
public:
int a[100];
int i,j,n,tmp;
void getdata();
void process();
void display();
};
void sort::getdata()
{
cout<<"Enter the Sort Number:";
cin>>n;
cout<<"Enter the Numbers:"<<endl;
for(i=1;i<=n;i++)
{
cin>>a[i];
}
}
void sort::process()
{
for(i=1;i<n;i++)
{
for(j=1;j<i;i++)
{
if(a[j]>a[j+1])
{
tmp=a[j];
a[j]=a[j+1];
a[j+1]=tmp;
}
}
}
}
void sort::display()
{
cout<<"Acending Order are:"<<endl;
for(i=1;i<=n;i++)
{
cout<<a[i]<<endl;
}
}
void main()
{
clrscr();
sort s;
[Link]();
[Link]();
[Link]();
getch();
}

You might also like