1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#include <iostream>
using namespace std;
int main()
{
int list[] = {4, 5, 6, 7, 3, 2, -1, -34, 9, 6, 8, 3}, len = 0, temp, k = 0;
int s = sizeof list / sizeof (int);
for (int i = len; i >= 0; i--)
{
if (list < list[len])
{
cout << "The value of 'List' is " << list << endl;
temp = list[i];
list[i] = list[len];
list[i+1] = temp;
}
}
len++;
while(k < s)
cout <<list[k++] << " ";
cout << endl;
return 0;
}
|