Hello!
I need some help figuring out how to display my array. The program I am working on is one in which the user can enter any given 20 integers and it display them in descending order. I was able to get that part to work but cannot get the inputed array to display with the results. I am using Visual C++. Any help would be greatly appreciated.
here is what I have...
#include "stdafx.h"
#include <iostream>
using namespace std;
const int N=20;
int main()
{
int a[N],i,nb,tmp;
for(i=0;i<N;i++)
{
cout << "Please enter an integer: ";
cin >> a[i];
}
do {
nb=0;
for (i=0;i<N-1;i++)
if (a[i]>a[i-1])
{
tmp=a[i];a[i]=a[i-1];a[i-1]=tmp;
nb++;
}
} while(nb!=0);
cout << "The sorted array:" << endl;
for (i=0;i<N;i++)
cout << "iIntegers[" << i << "] = " << a[i] << endl;
return 0;
}