Advertisement
Guest User

quartile

a guest
Feb 21st, 2012
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <ios>
  4. #include <string>
  5. #include <vector>
  6. #include <algorithm>
  7.  
  8. using std::cin;
  9. using std::cout;
  10. using std::endl;
  11. using std::sort;
  12. using std::string;
  13. using std::vector;
  14.  
  15. int main ()
  16. {
  17.     cout << "Enter integers";
  18.  
  19.     vector<int> vec;
  20.     int x; 
  21.  
  22.     while (cin >> x)
  23.         vec.push_back(x);
  24.    
  25.     typedef vector<int>::size_type vec_sz;
  26.     vec_sz size = vec.size();
  27.  
  28.     if (size==0){
  29.         cout << endl << "haha no" << endl;
  30.         return 1;
  31.     }
  32.  
  33.     int b;
  34.     b = size / 4;
  35.  
  36.     int n;
  37.     n = b;
  38.  
  39.     sort(vec.begin(), vec.end());
  40.  
  41.     while (0 < b){
  42.         cout << vec[b] << endl;
  43.         --b;   
  44.     }
  45.  
  46.     while (n < n + b){
  47.         cout << vec[n+b] << endl;
  48.         --b;
  49.     }
  50.  
  51.     while (2*n < 2*n + b){
  52.         cout << vec[2*n+b] << endl;
  53.         --b;
  54.     }
  55.  
  56.     while (3*n < 3*n + b){
  57.         cout << vec[3*n+b] << endl;
  58.         --b;
  59.     }
  60.  
  61.  
  62.     system("pause");
  63.     return 0;
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement