#include #include #include using namespace std; void kayit(int* puan, char* ad, int* pointo10, int* pointo9, int* pointo8, int* pointo7, int* pointo6, int* pointo5, int* pointo4, int* pointo3, int* pointo2, int* pointo1, char* namae1, char* namae2, char* namae3, char* namae4, char* namae5, char* namae6, char* namae7, char* namae8, char* namae9, char* namae10); int fabrika(); int main() { int pointo1 = 1000; int pointo2 = 900; int pointo3 = 800; int pointo4 = 700; int pointo5 = 600; int pointo6 = 500; int pointo7 = 400; int pointo8 = 300; int pointo9 = 200; int pointo10 = 100; char namae1[20] = { "juuza" }; char namae2[20] = { "shikisho" }; char namae3[20] = { "hannya" }; char namae4[20] = { "hyui" }; char namae5[20] = { "shuren" }; char namae6[20] = { "rihaku" }; char namae7[20] = { "rei" }; char namae8[20] = { "saito" }; char namae9[20] = { "ayame" }; char namae10[20] = { "suzume" }; hokuto: nanto: int urun = fabrika(); int x = urun / 1000; int y = (urun % 1000) / 100; int z = (urun % 100) / 10; int t = (urun % 10); //cout << endl << endl << x << endl << y << endl << z << endl << t << endl; // Fabrikanin kontrolu int shin = 0; int ken = 0; int kaze = 0; int hono = 0; for (int to = 1; to <= 10; to++) { int abcd; cin >> abcd; int e = abcd / 1000; int f = (abcd % 1000) / 100; int g = (abcd % 100) / 10; int h = (abcd % 10); // cout << e << endl << f << endl << g << endl << h << endl << endl; // Girilen sayinin kontrolu bool ich = (e == x); bool ni = (f == x); bool san = (g == x); bool yon = (h == x); bool go = (e == y); bool roku = (f == y); bool nana = (g == y); bool hachi = (h == y); bool kyuu = (e == z); bool juu = (f == z); bool juu_ichi = (g == z); bool juu_ni = (h == z); bool juu_san = (e == t); bool juu_yon = (f == t); bool juu_go = (g == t); bool juu_roku = (h == t); int kokoro = ich + ni + san + yon + go + roku + nana + hachi + kyuu + juu + juu_ichi + juu_ni + juu_san + juu_yon + juu_go + juu_roku; //cout << kokoro << endl << endl; if (e == f || e == g || e == h || f == g || f == h || g == h || e > 9) { if (e == f || e == g || e == h || f == g || f == h || g == h) { cout << "Lutfen rakamlari farkli olan bir sayi giriniz ! Ya da eksik rakam cevirdiniz !" << endl << endl; } if (e > 9) { cout << endl << "4'ten fazla basamagi olan bir sayi girdiniz !" << endl << endl; } } else { if (e != x && f == y && g == z && h == t && kokoro == 3) { cout << "-0, +3 " << "Girilen rakamlarin " << kokoro << " tanesi sayida var ve 3'u de dogru yerdedir." << endl << endl; } if (e == x && f != y && g == z && h == t && kokoro == 3) { cout << "-0, +3 " << "Girilen rakamlarin " << kokoro << " tanesi sayida var ve 3'u de dogru yerdedir." << endl << endl; } if (e == x && f == y && g != z && h == t && kokoro == 3) { cout << "-0, +3 " << "Girilen rakamlarin " << kokoro << " tanesi sayida var ve 3'u de dogru yerdedir." << endl << endl; } if (e == x && f == y && g == z && h != t && kokoro == 3) { cout << "-0, +3 " << "Girilen rakamlarin " << kokoro << " tanesi sayida var ve 3'u de dogru yerdedir." << endl << endl; } if (e != x && f != y && g == z && h == t && kokoro >= 2) { cout << "-" << (kokoro - 2) << ", +2 " << "Girilen rakamlarin " << kokoro << " tanesi sayida var ve 2'sini dogru yerde, " << (kokoro - 2) << " tanesini yanlis yerde tahmin ettiniz." << endl << endl; } if (e != x && f == y && g != z && h == t && kokoro >= 2) { cout << "-" << (kokoro - 2) << ", +2 " << "Girilen rakamlarin " << kokoro << " tanesi sayida var ve 2'sini dogru yerde, " << (kokoro - 2) << " tanesini yanlis yerde tahmin ettiniz." << endl << endl; } if (e != x && f == y && g == z && h != t && kokoro >= 2) { cout << "-" << (kokoro - 2) << ", +2 " << "Girilen rakamlarin " << kokoro << " tanesi sayida var ve 2'sini dogru yerde, " << (kokoro - 2) << " tanesini yanlis yerde tahmin ettiniz." << endl << endl; } if (e == x && f != y && g != z && h == t && kokoro >= 2) { cout << "-" << (kokoro - 2) << ", +2 " << "Girilen rakamlarin " << kokoro << " tanesi sayida var ve 2'sini dogru yerde, " << (kokoro - 2) << " tanesini yanlis yerde tahmin ettiniz." << endl << endl; } if (e == x && f != y && g == z && h != t && kokoro >= 2) { cout << "-" << (kokoro - 2) << ", +2 " << "Girilen rakamlarin " << kokoro << " tanesi sayida var ve 2'sini dogru yerde, " << (kokoro - 2) << " tanesini yanlis yerde tahmin ettiniz." << endl << endl; } if (e == x && f == y && g != z && h != t && kokoro >= 2) { cout << "-" << (kokoro - 2) << ", +2 " << "Girilen rakamlarin " << kokoro << " tanesi sayida var ve 2'sini dogru yerde, " << (kokoro - 2) << " tanesini yanlis yerde tahmin ettiniz." << endl << endl; } if (e != x && f != y && g != z && h == t && kokoro >= 1) { cout << "-" << (kokoro - 1) << ", +1 " << "Girilen rakamlarin " << kokoro << " tanesi sayida var ve 1'i dogru yerde, " << (kokoro - 1) << " tanesi yanlis yerde tahmin edilmistir." << endl << endl; } if (e != x && f != y && g == z && h != t && kokoro >= 1) { cout << "-" << (kokoro - 1) << ", +1 " << "Girilen rakamlarin " << kokoro << " tanesi sayida var ve 1'i dogru yerde, " << (kokoro - 1) << " tanesi yanlis yerde tahmin edilmistir." << endl << endl; } if (e != x && f == y && g != z && h != t && kokoro >= 1) { cout << "-" << (kokoro - 1) << ", +1 " << "Girilen rakamlarin " << kokoro << " tanesi sayida var ve 1'i dogru yerde, " << (kokoro - 1) << " tanesi yanlis yerde tahmin edilmistir." << endl << endl; } if (e == x && f != y && g != z && h != t && kokoro >= 1) { cout << "-" << (kokoro - 1) << ", +1 " << "Girilen rakamlarin " << kokoro << " tanesi sayida var ve 1'i dogru yerde, " << (kokoro - 1) << " tanesi yanlis yerde tahmin edilmistir." << endl << endl; } if (e != x && f != y && g != z && h != t && kokoro > 0) { cout << -(kokoro) << ", +0 " << "Girilen rakamlarin " << kokoro << " tanesi sayida var ve yerini/yerlerini yanlis tahmin ediyorsunuz." << endl << endl; } if (kokoro == 0) { cout << "-0" << ", +0 " << "Girilen rakamlarin bir tanesi bile sayida yoktur." << endl << endl; } if (kokoro == 4 && e != x && f != y && g != z && h != t) { shin = -4, ken = 0; } if (kokoro == 4 && e == x && f != y && g != z && h != t) { shin = -3, ken = 1; } if (kokoro == 4 && e != x && f == y && g != z && h != t) { shin = -3, ken = 1; } if (kokoro == 4 && e != x && f != y && g == z && h != t) { shin = -3, ken = 1; } if (kokoro == 4 && e != x && f != y && g != z && h == t) { shin = -3, ken = 1; } if (kokoro == 4 && e == x && f == y && g != z && h != t) { shin = -2, ken = 2; } if (kokoro == 4 && e == x && f != y && g == z && h != t) { shin = -2, ken = 2; } if (kokoro == 4 && e == x && f != y && g != z && h == t) { shin = -2, ken = 2; } if (kokoro == 4 && e != x && f == y && g == z && h != t) { shin = -2, ken = 2; } if (kokoro == 4 && e != x && f == y && g != z && h == t) { shin = -2, ken = 2; } if (kokoro == 4 && e != x && f != y && g == z && h == t) { shin = -2, ken = 2; } if (kokoro == 4 && e == x && f == y && g == z && h != t) { shin = -1, ken = 3; } if (kokoro == 4 && e == x && f == y && g != z && h == t) { shin = -1, ken = 3; } if (kokoro == 4 && e == x && f != y && g == z && h == t) { shin = -1, ken = 3; } if (kokoro == 4 && e != x && f == y && g == z && h == t) { shin = -1, ken = 3; } if (kokoro == 4 && e == x && f == y && g == z && h == t) { shin = 0, ken = 4; } if (kokoro == 3 && e != x && f != y && g != z && h != t) { shin = -3, ken = 0; } if (kokoro == 3 && e == x && f != y && g != z && h != t) { shin = -2, ken = 1; } if (kokoro == 3 && e != x && f == y && g != z && h != t) { shin = -2, ken = 1; } if (kokoro == 3 && e != x && f != y && g == z && h != t) { shin = -2, ken = 1; } if (kokoro == 3 && e != x && f != y && g != z && h == t) { shin = -2, ken = 1; } if (kokoro == 3 && e == x && f == y && g != z && h != t) { shin = -1, ken = 2; } if (kokoro == 3 && e == x && f != y && g == z && h != t) { shin = -1, ken = 2; } if (kokoro == 3 && e == x && f != y && g != z && h == t) { shin = -1, ken = 2; } if (kokoro == 3 && e != x && f == y && g == z && h != t) { shin = -1, ken = 2; } if (kokoro == 3 && e != x && f == y && g != z && h == t) { shin = -1, ken = 2; } if (kokoro == 3 && e != x && f != y && g == z && h == t) { shin = -1, ken = 2; } if (kokoro == 3 && e == x && f == y && g == z && h != t) { shin = 0, ken = 3; } if (kokoro == 3 && e == x && f == y && g != z && h == t) { shin = 0, ken = 3; } if (kokoro == 3 && e == x && f != y && g == z && h == t) { shin = 0, ken = 3; } if (kokoro == 3 && e != x && f == y && g == z && h == t) { shin = 0, ken = 3; } if (kokoro == 2 && e != x && f != y && g != z && h != t) { shin = -2, ken = 0; } if (kokoro == 2 && e == x && f != y && g != z && h != t) { shin = -1, ken = 1; } if (kokoro == 2 && e != x && f == y && g != z && h != t) { shin = -1, ken = 1; } if (kokoro == 2 && e != x && f != y && g == z && h != t) { shin = -1, ken = 1; } if (kokoro == 2 && e != x && f != y && g != z && h == t) { shin = -1, ken = 1; } if (kokoro == 2 && e == x && f == y && g != z && h != t) { shin = 0, ken = 2; } if (kokoro == 2 && e == x && f != y && g == z && h != t) { shin = 0, ken = 2; } if (kokoro == 2 && e == x && f != y && g != z && h == t) { shin = 0, ken = 2; } if (kokoro == 2 && e != x && f == y && g == z && h != t) { shin = 0, ken = 2; } if (kokoro == 2 && e != x && f == y && g != z && h == t) { shin = 0, ken = 2; } if (kokoro == 2 && e != x && f != y && g == z && h == t) { shin = 0, ken = 2; } if (kokoro == 1 && e != x && f != y && g != z && h != t) { shin = -1, ken = 0; } if (kokoro == 1 && e == x && f != y && g != z && h != t) { shin = 0, ken = 1; } if (kokoro == 1 && e != x && f == y && g != z && h != t) { shin = 0, ken = 1; } if (kokoro == 1 && e != x && f != y && g == z && h != t) { shin = 0, ken = 1; } if (kokoro == 1 && e != x && f != y && g != z && h == t) { shin = 0, ken = 1; } if (kokoro == 0) { shin = 0, ken = 0; } kaze = kaze + shin; hono = hono + ken; } //cout << kaze << " " << hono << " " << kokoro << endl; if (e == x && f == y && g == z && h == t && kokoro == 4) { cout << "-0, +4 " << "Girilen rakamlarin " << kokoro << " tanesi de sayida var ve 4'u de dogru yerdedir. " << endl << endl; cout << to << ". denemede bildiniz !" << endl << endl; int puan = (10 * (hono)+(5 * (-kaze))) + (((float)1 / (float)to) * 1000) - ((float)((hono) * (-kaze)) / (float)((hono)+(-kaze))); cout << "PUANINIZ: " << puan << endl << endl; if (puan < pointo10) { cout << "Ilk 10 siralamasina giremediniz."; cout << endl << " + YENI SAYI OLUSTURULDU !" << endl << endl; } if (puan >= pointo10) { cout << "Ilk 10 siralamasina girdiniz." << endl << "Adinizi bosluk birakmadan giriniz." << endl << endl; char ad[20]; cin >> ad; // cout << ad; kayit(&puan, ad, &pointo10, &pointo9, &pointo8, &pointo7, &pointo6, &pointo5, &pointo4, &pointo3, &pointo2, &pointo1, namae1, namae2, namae3, namae4, namae5, namae6, namae7, namae8, namae9, namae10); cout << endl << "YENI SAYI OLUSTURULDU !" << endl; } goto hokuto; } if (to == 10) { cout << "DENEME HAKKINIZ DOLDU ! BASARAMADINIZ !" << endl << "SAYI " << x << y << z << t << " IDI." << endl << endl; } } cout << " - YENI SAYI OLUSTURULDU !" << endl; goto nanto; return 0; } void kayit(int* puan, char* ad, int* pointo10, int* pointo9, int* pointo8, int* pointo7, int* pointo6, int* pointo5, int* pointo4, int* pointo3, int* pointo2, int* pointo1, char* namae1, char* namae2, char* namae3, char* namae4, char* namae5, char* namae6, char* namae7, char* namae8, char* namae9, char* namae10) { if (*puan >= *pointo10 && *puan < *pointo9) { cout << endl << endl << "10. OLDUNUZ !" << endl << endl; cout << "Sizden onceki 10. kisi " << namae10 << " idi. Puani da " << *pointo10 << " idi." << endl; *pointo10 = *puan; for (int i = 0; i <= 20; i++) { namae10[i] = ad[i]; } } if (*puan >= *pointo9 && *puan < *pointo8) { cout << endl << endl << "9. OLDUNUZ !" << endl << endl; cout << "Sizden onceki 9. kisi " << namae9 << " idi. Puani da " << *pointo9 << " idi." << endl; *pointo9 = *puan; for (int i = 0; i <= 20; i++) { namae9[i] = ad[i]; } } if (*puan >= *pointo8 && *puan < *pointo7) { cout << endl << endl << "8. OLDUNUZ !" << endl << endl; cout << "Sizden onceki 8. kisi " << namae8 << " idi. Puani da " << *pointo8 << " idi." << endl; *pointo8 = *puan; for (int i = 0; i <= 20; i++) { namae8[i] = ad[i]; } } if (*puan >= *pointo7 && *puan < *pointo6) { cout << endl << endl << "7. OLDUNUZ !" << endl << endl; cout << "Sizden onceki 7. kisi " << namae7 << " idi. Puani da " << *pointo7 << " idi." << endl; *pointo7 = *puan; for (int i = 0; i <= 20; i++) { namae7[i] = ad[i]; } } if (*puan >= *pointo6 && *puan < *pointo5) { cout << endl << endl << "6. OLDUNUZ !" << endl << endl; cout << "Sizden onceki 6. kisi " << namae6 << " idi. Puani da " << *pointo6 << " idi." << endl; *pointo6 = *puan; for (int i = 0; i <= 20; i++) { namae6[i] = ad[i]; } } if (*puan >= *pointo5 && *puan < *pointo4) { cout << endl << endl << "5. OLDUNUZ !" << endl << endl; cout << "Sizden onceki 5. kisi " << namae5 << " idi. Puani da " << *pointo5 << " idi." << endl; *pointo5 = *puan; for (int i = 0; i <= 20; i++) { namae5[i] = ad[i]; } } if (*puan >= *pointo4 && *puan < *pointo3) { cout << endl << endl << "4. OLDUNUZ !" << endl << endl; cout << "Sizden onceki 4. kisi " << namae4 << " idi. Puani da " << *pointo4 << " idi." << endl; *pointo4 = *puan; for (int i = 0; i <= 20; i++) { namae4[i] = ad[i]; } } if (*puan >= *pointo3 && *puan < *pointo2) { cout << endl << endl << "3. OLDUNUZ !" << endl << endl; cout << "Sizden onceki 3. kisi " << namae3 << " idi. Puani da " << *pointo3 << " idi." << endl; *pointo3 = *puan; for (int i = 0; i <= 20; i++) { namae3[i] = ad[i]; } } if (*puan >= *pointo2 && *puan < *pointo1) { cout << endl << endl << "2. OLDUNUZ !" << endl << endl; cout << "Sizden onceki 2. kisi " << namae2 << " idi. Puani da " << *pointo2 << " idi." << endl; *pointo2 = *puan; for (int i = 0; i <= 20; i++) { namae2[i] = ad[i]; } } if (*puan >= *pointo1) { cout << endl << endl << "1. OLDUNUZ !" << endl << endl; cout << "Sizden onceki 1. kisi " << namae1 << " idi. Puani da " << *pointo1 << " idi." << endl; *pointo1 = *puan; for (int i = 0; i <= 20; i++) { namae1[i] = ad[i]; } } } int fabrika() { srand(time(0)); int x = rand() % 10; //cout << x << endl; int y = rand() % 10; if (y == x) { while (y == x) { y = rand() % 10; if (y != x) { //cout << y << endl; } } } //else { cout << y << endl; } int z = rand() % 10; if (z == x || z == y) { while (z == x || z == y) { z = rand() % 10; if (z != x && z != y) { //cout << z << endl; } } } //else { cout << z << endl; } int t = rand() % 10; if (t == x || t == y || t == z) { while (t == x || t == y || t == z) { t = rand() % 10; if (t != x && t != y && t != z) { //cout << t << endl; } } } //else { cout << t << endl; } // cout << endl << x << endl << y << endl << z << endl << t << endl; cout << endl << "4 basamakli ve rakamlari farkli sayiyi tahmin ediniz. Ilk basamak 0 da olabilmektedir. 10 deneme hakkiniz vardir." << endl << endl; return (1000 * x + 100 * y + 10 * z + t); }