dev/cpp/bookAmmeraal/02/main.cpp

34 lines
667 B
C++
Raw Normal View History

/* STL */
#include <algorithm>
#include <deque>
#include <functional>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
/* STD */
#include <iostream>
#include <string>
#include <cstdlib>
#include <math.h>
using namespace std;
int main (int argc, char *argv[]) {
int a[10], x, n = 0, *p;
cout << "Enter at most 10 positive integers, followed by 0:\n";
while (cin >> x, x != 0 && n < 10) a[n++] = x;
sort(a, a+n);
cout << "After sorting: \n";
for (p=a; p != a+n; p++) cout << *p << " ";
cout << endl;
return 0;
}