Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <ctime>
- using namespace std;
- int T1[100][6], T2[100][6], T3[100][6];
- void GenTir(int tir)
- {
- int n, c, a[n];
- bool equiv;
- for (int n = 0; n<6; n++) {
- cout << "\n Vuvedete " <<n+1<< " chislo za tegleneto : " ; cin>>a[n] ;
- }
- for (n = 0; n<6; n++)
- {
- do
- {
- T1[tir][n] = 1 + rand() % 49;
- equiv = false;
- for (c = 0; c<n; c++)
- if (T1[tir][c] == T1[tir][n]) equiv = true;
- } while (equiv);
- }
- for (n = 0; n<6; n++)
- {
- do
- {
- T2[tir][n] = 1 + rand() % 49;
- equiv = false;
- for (c = 0; c<n; c++)
- if (T2[tir][c] == T2[tir][n]) equiv = true;
- } while (equiv);
- }
- for (n = 0; n<6; n++)
- {
- do
- {
- T3[tir][n] = 1 + rand() % 49;
- equiv = false;
- for (c = 0; c<n; c++)
- if (T3[tir][c] == T3[tir][n]) equiv = true;
- } while (equiv);
- }
- }
- void Gen(void)
- {
- int t;
- for (t = 0; t<1; t++)
- GenTir(t);
- }
- void BrIzZaVsTeglene(int tegl)
- {
- int tg;
- cout << endl << "Nomer na teglene (1-3): "; cin >> tg; while (tg<1 || tg>3);
- int Br[49] = { 0 }, t, n;
- for (t = 0; t<100; t++)
- for (n = 0; n<6; n++)
- {
- if (tegl == 1) Br[T1[t][n] - 1]++;
- if (tegl == 2) Br[T2[t][n] - 1]++;
- if (tegl == 3) Br[T3[t][n] - 1]++;
- }
- for (n = 0; n<49; n++)
- cout << "Chisloto " << 1 + n << " e iztegleno " << Br[n] << " puti" << endl;
- }
- void DesetNayChesto(void)
- {
- int Br[49] = { 0 }, t, n, index, maxbr;
- for (t = 0; t<100; t++)
- for (n = 0; n<6; n++)
- {
- Br[T1[t][n] - 1]++;
- Br[T2[t][n] - 1]++;
- Br[T3[t][n] - 1]++;
- }
- for (n = 0; n<10; n++)
- {
- index = 0;
- maxbr = Br[index];
- for (t = 0; t<49; t++)
- if (Br[t]>maxbr)
- {
- index = t; maxbr = Br[t];
- }
- cout << "Chisloto" << 1 + index << " e iztegleno " << Br[index] << " puti" << endl;
- Br[index] = 0;
- }cout << endl << endl;
- }
- void Analize(void)
- {
- int ch, tegl;
- do
- {
- cout << endl << endl << "1. Kolichestva na vsichki chisla" << endl;
- cout << "2. 10 nay chesto izteglqni" << endl;
- cout << "3. Glavno menu" << endl << endl;
- do
- {
- cout << "Your choice: ";
- cin >> ch;
- } while (ch<0 || ch>3);
- switch (ch)
- {
- case 1: BrIzZaVsTeglene(tegl); break;
- case 2: DesetNayChesto(); break;
- }
- } while (ch != 3);
- }
- void Izvejdane(void)
- {
- int tir, n;
- cout << endl << "Tiraj (1-100): "; cin >> tir;
- cout << endl << "I-vo teglene:" << endl;
- for (n = 0; n<6; n++)
- cout << T1[tir][n] << " ";
- cout << endl << "II-ro teglene:" << endl;
- for (n = 0; n<6; n++)
- cout << T2[tir][n] << " ";
- cout << endl << "III-to teglene:" << endl;
- for (n = 0; n<6; n++)
- cout << T3[tir][n] << " ";
- cout << endl << endl;
- }
- int main()
- {
- srand(time(NULL));
- cout << "TOTO 6 / 49" << endl;
- int ch;
- do {
- cout << "\n\t Menu\n";
- cout << "\n 1.Generirane";
- cout << "\n 2.Analiz";
- cout << "\n 3.izvejdane na chisla za tiraj T i teglene I-III";
- cout << "\n 4.Exit";
- do {
- cout << "\n Your choice:";
- cin >> ch;
- } while (ch<1 || ch>4);
- switch (ch)
- {
- case 1: Gen(); break;
- case 2: Analize(); break;
- case 3: Izvejdane(); break;
- case 4:;
- }
- } while (ch != 4);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment