#include <iostream>
#include <vector>
using std::cout;
using std::cin;
using std::endl;
using std::vector;
//input elements for the vector class object v.
void input(vector<int> &v);
//display the elements.
void output(vector<int> v);
//return the bool value. If the elements are ascending, return 1,otherwise return 0.
bool isAscendingOrder(vector<int> v);
int main()
{
vector<int> v;
input(v);//Input elements.
if (isAscendingOrder(v))
cout << "The elements are ascending!" << endl;
else
cout << "The elements are not ascending!" << endl;
output(v);//output elements.
system("pause");
return 0;
}
void input(vector<int> &v){
int numbers;
int num;
cout << "How many numbers do you want to enter: ";
cin >> numbers;
cout << "Enter "<< numbers << " for a group of integer numbers:" << endl;
for (int i = 0; i < numbers; i++)
{
cin >> num;
v.push_back(num);
}
}//End input
//If it is ascending, return 1, otherwise return 0;
bool isAscendingOrder(vector<int> v)
{
for (int i = 0, j = 1; i < v.size() && j < v.size(); i++, j++)
{
if (v[i] > v[j])
return 0;
}
return 1;
}//End isAscendingOreder
//function output
void output(vector<int> v)
{
for (int i = 0; i < v.size(); i++)
cout << v[i] << " ";
cout << endl;
}//End output