English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

your integer inputs in descending order. use function

2007-03-05 19:51:00 · 1 answers · asked by langga 1 in Computers & Internet Programming & Design

1 answers

There are several conditions...

First, if you know the number of inputs...
then..

int arr[n]; // n is actual number

for (int i=0; i cin>>arr[i];

for (i=0; i {
for(int j=i+1; j {
if(arr[i]>arr[j])
{
int temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
cout< }

return 0;


Second, if you don't know the number of inputs...
then...

you can either (ask the number to create the integer-array in dinamically by using new-operator) or (use the linked-list dinamic-in-nature)...

If you wanna get more details on these conditions...
then send your mail to me... cruisernk@yahoo.com

Long Live!!!

2007-03-05 20:27:30 · answer #1 · answered by QuizBox 2 · 0 0

fedest.com, questions and answers