Hi everyone , I'm training on C++ language and I have some troubles about array. My problem is arranging in array. Example, I have an float array, I wanna sort my negative numbers descending on the left, the zero (0) numbers in the middle and positive number ascending on the right in three ways: selection sort, insert sort and bubble sort. I hope you spare a little time to help me. Code: #include <stdio.h> #include <conio.h> #include <iostream.h> void input(int *a, int n) { for(int i=0;i<n;i++) { cout << "a[" << i << "]= "; cin >> a[i]; } } void output(int *a,int n) { for(int i=0;i<n;i++) { cout << a[i] << "\t"; } } void swap(int &a,int &B) { int tmp=a; a=b; b=tmp; } void main() { clrscr(); int n; int *a; cout << "Enter numbers of array: "; cin >> n; input(a,n); output(a,n); getch(); } Thanks in advance and have a nice day.

Hi, welcome to the vast world of programming. Two of the most essential tools you need are Google and Wikipedia. Googling each type of sort - for me - returned a well written Wiki article as the top hit; here are the links: http://en.wikipedia.org/wiki/Bubble_sort http://en.wikipedia.org/wiki/Insertion_sort http://en.wikipedia.org/wiki/Selection_sort Also make sure you read IN FULL and act on this one: http://www.catb.org/~esr/faqs/smart-questions.html If you ask questions as outlined here you can be sure to get quality help. This is a great article. I'm going to put it in my sig, if I can.