Advertisement
Guest User

Untitled

a guest
May 11th, 2015
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void nov_massiv(int *p, int n, int k);
  5.  
  6. int main()
  7. {
  8.     int x, s, k, y, len = 0;
  9.     int p = 1;
  10.     cout << "vvedi chislo ";
  11.     cin >> x;
  12.     int dubx;
  13.     dubx = x;
  14.     while (dubx){
  15.         k = dubx % 10;
  16.         len++;
  17.         dubx = dubx / 10;
  18.     }
  19.      
  20.     int temp, rlast,rfirst ;
  21.     temp = len;
  22.     rlast = len;
  23.     y = x % 10;
  24.     int pfix = 1;
  25.     while (x){
  26.          
  27.         s = x % 10;
  28.         if (s < y){
  29.              
  30.             p++;
  31.         }
  32.         else {
  33.             if ((temp - p) > 0)
  34.                 rlast = temp;  
  35.            
  36.             if (p>pfix)
  37.                  
  38.                 pfix = p;
  39.             p = 1;
  40.              
  41.         }
  42.         y = s;
  43.         x = x / 10;
  44.         temp--;
  45.     }
  46.      
  47.     if (p > pfix) pfix = p;
  48.      
  49.     if (pfix > 1)
  50.  
  51.     {
  52.         cout << "naibolshaya vozrastayschaya posled ravna" << pfix;
  53.         cout << "\nposlednij razryad" << rlast;
  54.         rfirst = rlast - pfix + 1;
  55.         cout << "\npervui razryad" << rfirst;
  56.     }
  57.     else cout << "net posledovatelnosti";
  58.      
  59.     system("pause");
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement