You declare array1 in an else statement, which means that the scope of array1 will be that else, which means that array1 will be destroyed when you exit the else statement's scope.
The scope is basically the curly braces in which an object is declared. So, if you declare object1 in a function called ExampleFunction, you can't use object1 outside of that function. Read more here: http://msdn.microsoft.com/en-us/library/b7kfh662(v=vs.80).aspx
#include<iostream>
usingnamespace std;
int main()
{
int size;
do
{
cout << "Enter the size of the array: " << endl;
cin >> size;
if (size > 100)
cout << "The maximun size of the array is 100 " << endl;
}
while (size > 100); // This asks the user to input a size until it is smaller or equal to 100
int array1[size];
double value; // No use declaring as double if the array is declared as int
int i;
for (i=0;i<size;i++)
{
cout << "Enter a value for element " << (i+1) << endl;
cin >> value;
array1[i] = value;
}
return 0;
}
the question said to call another function to rarrange the values in increasing order
I know how to call a function , But, I don't know how to do the increasing order??