2008-12-04 23:12:55 UTC
InsertionSort.cpp:35: error: expected constructor, destructor, or type conversion before '<<' token
InsertionSort.cpp:35: error: expected `,' or `;' before '<<' token
InsertionSort.cpp:36: error: expected declaration before '}' token
#include
using namespace std;
#define MAX_LIST_LEN 2000
int main(){
int n, j, a[j], temp, L = 2;
double list[MAX_LIST_LEN];
cout << "Enter list length (must be less than or equal to "
<< MAX_LIST_LEN << "): ";
cin >> n;
cout << "Enter " << n << " numbers:" << endl;
for(j=0; j
}
while (L <= n)
{
j = L;
while ((j>=2) && (a[j] < a[j-1]))
{
temp = a[j];
a[j] = a[j-1];
a[j-1] = temp;
j--;
L--;
}
}
}
cout << a[j];
}
cout << endl;
return(0);
}
I am new to c++, so can someone please tell me how to fix this problem? Thanks.