I'm calling sortprint but how can I Implement it? I also want to implement a the sort function.
I highlighted some of the things in red.
#include <iostream>
#include <vector>
using namespace std;
void sortPrint( const vector<int>& v);
int main()
{
vector<int> v;
vector<int>::iterator iter;
int num;
cout <<"Enter the number you want to be sort and print than push ctrl z to end it. "<<endl;
while(cin>>num)
{
v.push_back(num);
}
cout<<"The numbers you enter are :";
sortPrint(v);
cout<<endl;
cout<<"The numbers in ascending order is :"<<endl;
sort (v.begin(), v.end());
for (iter=v.begin(); iter!=v.end(); ++iter)
{
cout<< *iter << " ";
}
cout<<endl<<endl;
system ("pause");
return 0;
}
void sortPrint( const vector<int>& v)
{
for(int i=0; i<v.size(); ++i)
{
cout << v[i] << " ";
}
cout << endl;
}