Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <conio.h>
- #include <iostream>
- #include <cmath>
- #include <cstdlib>
- #include <ctime>
- using namespace ::std;
- int Mass[23];
- bool van;
- const int N(100);
- bool proof(void)
- {
- for (int akk(0); akk < N; akk++)
- {
- for (int akkk(N-1); akkk > akk; akkk--)
- {
- if (Mass[akk] == Mass[akkk]){ van = true; }
- }
- }
- return van;
- }
- int main(void)
- {
- setlocale(LC_ALL, "Russian");
- srand(time(NULL));
- int algodlinn, protrue(0);
- cout << "Сколько раз произвести вычисления? - ";
- cin >> algodlinn;
- for (short int i(0); i < algodlinn; i++)
- {
- system("cls");
- for (int ak(0); ak < N; ak++)
- {
- Mass[ak] = rand() % 365;
- }
- for (int ak(0), akk(0); ak < N; ak++)
- {
- cout << Mass[ak] << " ";
- akk++;
- akk = akk % 7;
- if (akk == 6) cout << endl;
- }
- van = false;
- if (proof() == true) protrue++;
- cout << endl << ((double)i / (algodlinn-1)) * 100 << "%";
- cout << endl << ((double)protrue / i) * 100 << "%";
- }
- cout << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement