// test.cpp : main project file. #include "stdafx.h" #include "iostream" using namespace std; int main() { //using __int64 for more accuracy int arraySize; //number of elements in the array int arrayInt; //number for the array __int64 c; //for sorting int x; //smallest int y; //output's position cout << "Please enter the size of the array\n"; cin >> arraySize; if (arraySize > 0) { __int64* integerArray = new __int64[arraySize]; //input array __int64* outputArray = new __int64[arraySize]; //output array for (int i = 0; i < arraySize; i++) { cout << "Please enter an integer\n"; cin >> arrayInt; integerArray[i] = arrayInt; //values for integer } for (int ii = 0; ii < arraySize; ii++) { c = 9999999999999999999; for (int iii = ii + 1; iii < arraySize; iii++) { if (integerArray[ii] < integerArray[iii] && integerArray[ii] < c) { c = integerArray[ii]; x = ii; y = ii; } else { c = integerArray[iii]; x = iii; if (ii == 0) { y = iii; } } if (iii == (arraySize - 1)) { integerArray[x] = 9999999999999999; } } outputArray[ii] = c; } for (int i = 0; i < arraySize; i++) { cout << outputArray[i]; cout << "\n"; } cout << "The smallest number you entered was "; cout << outputArray[0]; cout << "\n That number was the "; cout << y + 1; cout << " number you entered"; } system("pause"); return 0; }