making a number sequence

con anybody tell me where is the error statement below? it, sequencing numbers but it will not run properly..
#include <iostream>
using namespace std;
int B ;
int main ()
{
cout << "insert the number of the sequence " ; cin >> B;
cout << "Number of sequencen " << B <<endl;
int A[B];

cout << "input values "<< endl;
int j, k, C, tmp;
for (C=0; C<B; C++)
{ cout << "A["<<C<<"] = "; cin >> A[C];}
cout << " values are " << endl;
for (C=0; C<B; C++)
{cout << "A["<<C<<"] = " << A[C]<< endl;}
// sequencing the data
for (j = 0; j < B; j++)
{
for (k = B ; k < B; k++)
{
if (A[k] > A[k+1])
{ tmp = A[k]; A[k] = A[k+1]; A[k+1] = tmp;}
}
}
cout << "the sequence are "<<endl;
for (C = 0; C < B; C++)
{cout << "A["<<C<<"] = " << A[C]<< endl;}
return 0;
}
Topic archived. No new replies allowed.