help..!!

#include <iostream>
#include <conio.h>
using namespace std;

int bubbleSort(int arr[], int s)
{
char a, d;
cout << "Enter Size of Array :";
cin >> s;
int* iptr = new int [s];
for (int i = 0; i < s; i++)
{
cout << "input " << i + 1 << ":";
cin >> iptr[i];
}
cout << "Press a for ascending.\n Press d for descending.";
int op = 0;
switch (op){

case 'a':
int I, J, Temp;

for (I = 0; I<s - 1; I++)
{
for (J = 0; J<(s - 1 - I); J++)

if (arr[J]>arr[J + 1])
{
Temp = arr[J]; //swapping
arr[J] = arr[J + 1];
arr[J + 1] = Temp;

}

}
cout << "The elements of the array are:\n";
for (int I = 0; I<s; I++)
cout << arr[I] << " ";

}
case 'd':
int I, J, Temp;
for (I = 0; I<s - 1; I++)
{
for (J = 0; J<(s - 1 - I); J++)
if (arr[J]<arr[J + 1])
{
Temp = arr[J]; //swapping
arr[J] = arr[J + 1];
arr[J + 1] = Temp;

}

}
cout << "The elements of the array are:\n";

for (int I = 0; I<s; I++)
cout << arr[I] << " ";

}
int main()
{
int arr, s;

bubbleSort( arr, s);

_getch();
}


not working ??
Last edited on
Edit your code and use code tags, your code is unreadable - http://www.cplusplus.com/articles/jEywvCM9/
its my 1st post so thats like..plz just tell me that what should i do to call bubblesort function in int main..
Please edit your post and use code tags. Why should we help you if you're not even willing to help us make it easier?
bubbleSort requires an array. You don't have one to feed it. Remedy that.
Thanks so very much for your tip. Obviously I am new to the board. Thanks for your patience. I have fixed and reposted. :-D
Since you're editing your OP, please could you edit it to use code tags?

http://www.cplusplus.com/articles/z13hAqkS/
Topic archived. No new replies allowed.