Advertisement
Kolyach

4.6

Dec 2nd, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <ctime>
  4. #include <cmath>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9.     setlocale(LC_ALL, "Russian");
  10.     srand(time(0));
  11.     cout << "Для 1 варианта: \n";
  12.     long long m1 = 37, i1 = 3, c1 = 64, m2 = 25173, i2 = 13849, c2 = 65537;
  13.     int s1 = rand() % c1;
  14.     cout << "Сгенерированное число: " << (m1 * s1 + i1) % c1 << endl;
  15.  
  16.     cout << "Для 2 варианта: " << endl;
  17.     int s2 = rand() % c2;
  18.     cout << "Сгенерированное число: " << (m2 * s2 + i2) % c2 << endl;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement