Advertisement
Racknoss

The number of combinations v1.3

Jul 14th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     setlocale(LC_ALL, "Russian");
  10.     cout << "Введите длину до 49: ";
  11.     short int dlin, big, c(0);
  12.     long long var(0);
  13.     cin >> dlin;
  14.     bool f(false);
  15.     short int Mass[51];
  16.     while ( c < 51) {Mass[c] = 0; c++;}
  17.     cout << "Введите размер символа (>2): ";
  18.     cin >> big;
  19.     while(Mass[dlin]  == 0)
  20.     {
  21.         Mass[0]++;
  22.         for(short int df(0); df <= (49); df++)
  23.             {
  24.                 Mass[df+1] = Mass[df+1] + (Mass[df] / big);
  25.                 Mass[df] = Mass[df] % big;
  26.             }
  27.         for(short int i(0); i < dlin; i++)
  28.         {
  29.             cout << Mass[i] << " ";
  30.         }
  31.         cout << endl;
  32.         var++;
  33.         f = false ;
  34.     }
  35.     cout << "Кол-во вариантов - " << var << "\n";
  36.     cout << "\t\t\t<<<Made by Racknoss>>>";
  37.     _getch();
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement