2nd Pls Help [urgent]

Cannot run

[Linker error] undefined reference to `WinMain@16'
ld returned 1 exit status

// Program 5.11
// Bubble Sort
#include <iostream>
using namespace std;

void BubbleSort(int data[], int listSize)
{ int pass, tempValue;
for ( pass =1;pass < listSize; pass++)
{
// moves the largest element to the
// end of the array
for (int x = 0; x < listSize - pass; x++)
//compare adjacent elements
if ( data[x]>data[x+1] )
{//swap elements
tempValue = data[x];
data[x] = data[x+1];
data[x+1] = tempValue;
}//end if
} // end for
} // end Bubble Sort
Same thing as your other post... there is no main function.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
using namespace std;

void BubbleSort(int data[], int listSize)
{ 
    int pass, tempValue;
    for ( pass =1;pass < listSize; pass++)
    {
    // moves the largest element to the
    // end of the array
    for (int x = 0; x < listSize - pass; x++)
    //compare adjacent elements
        if ( data[x]>data[x+1] )
        {//swap elements
            tempValue = data[x];
            data[x] = data[x+1];
            data[x+1] = tempValue;
        }//end if
    } // end for
} // end Bubble Sort  
Topic archived. No new replies allowed.