Code:

#include <iostream>
using namespace std;
void swap (int array[], int first_index, int second_index);
int findSmallestRemainingElement(int array[], int size, int index);
int store (int array[], int size)
{
std::cout << "Enter the number(s) you want to store: \n";
int values, count = size;
for (int i=0;i<size;i++)
{
std::cin >> values;
array[i] = values;
count--;
std::cout << "-----" << count << "----- values left to be entered.\n";
}
return true;
}
void sort(int array[], int size)
{
for ( int i=0; i<size ;i++)
{
int index = findSmallestRemainingElement(array,size,i);
swap(array, i, index );
}
}
int findSmallestRemainingElement(int array[], int size, int index)
{
int index_of_smallest_value = index;
for (int i = index+1 ; i<size ; i++)
{
if ( array[i] < array [index_of_smallest_value])
{
index_of_smallest_value = i;
}
}
return index_of_smallest_value;
}
void swap (int array[], int first_index, int second_index )
{
int temp = array[first_index];
array[first_index] = array[second_index];
array[second_index] = temp;
}
void displayarray (int array[], int size)
{
std::cout << "{";
for (int i = 0 ;i <size ; i++)
{
if (i !=0)
{
std::cout << ", ";
}
} std::cout << array[i];
std::cout << "}";
}
int main()
{ std::cout << "How many values would you like to store? \n";
int size;
std::cin >> size;
int array[size];
store(array, size);
sort(array,size);
displayarray(array,size);
return 0;
}

Compiler error:

\main.cpp||In function 'void displayarray(int*, int)':|

\main.cpp|64|error: name lookup of 'i' changed for ISO 'for' scoping|

\main.cpp|64|note: (if you use '-fpermissive' G++ will accept your code)|

||=== Build finished: 1 errors, 0 warnings ===|