My TripleX Codes


#include <iostream>
#include <ctime>
using namespace std;


void PrintIntroduction(int Difficulty)
{
    cout << "        _________   _________"<<endl;
    cout << "   ____|EL   52| | KITABI 53 |____"<<endl;
    cout << " || ------------- |  ------------ ||" <<endl;
    cout << "||| ------------- | ------------- |||" << endl;
    cout << "||| ------------- | ------------- |||" << endl;
    cout << "||| ------------- | ------------- |||" << endl;
    cout << "||| ------------- | ------------- |||" << endl;
    cout << "||| ------------- | ------------- |||" << endl;
    cout << "||| ------------- | ------------- |||" << endl;
    cout << "||| ------------- | ------------- |||" << endl;
    cout << "||| ------------- | ------------- |||" << endl;
    cout << "||| ------------- | ------------- |||" << endl;
    cout << "||| ------------- | ------------- |||" << endl;
    cout << "|||_____________  |  _____________|||" << endl;
    cout << " ||_____________||_||_____________||" << endl;
    cout << endl;
    cout << endl;


    // Ekrana başlangıç bilgilerini yazdır.
    cout << "Uzay mekigi kalkisi icin son hazirlikleri yapma vakti.\n";
    cout << "Kalkiste sorun olusmamasi icin gorevini dogru yapmalisin.\n";
    cout << "Kodu dogru gir ve kalkis gerceklesene kadar devam et.\n";
    cout << "Tum kodlari dogru sekilde girdiginde kalkis baslayacak.\n";
    cout << "\nLevel:" << Difficulty;

    
}


bool PlayGame(int Difficulty)
{
    PrintIntroduction(Difficulty);

    // 3 Kodumuzun atandığı kısım.
    const int CodeA = rand() % Difficulty + Difficulty;
    const int CodeB = rand() % Difficulty + Difficulty;
    const int CodeC = rand() % Difficulty + Difficulty;

    const int CodeToplam = CodeA + CodeB + CodeC;
    const int CodeÇarpım = CodeA * CodeB * CodeC;

    // Toplam ve çarpımların yazdırıldığı kısım.
    cout << "\n+ Kod 3 sayidan olusmaktadir.";
    cout << "\n+ Koddaki Sayilarin Toplami:" << CodeToplam;
    cout << "\n+ Koddaki Sayilarin Carpimi:" << CodeÇarpım << endl;

    // Oyuncu tahminleri kısmı
    int GuessA;
    int GuessB;
    int GuessC;

    cout << endl;
    cout << "Kod Bir Tahmininiz:"; cin >> GuessA;
    cout << "Kod Iki Tahmininiz:"; cin >> GuessB;
    cout << "Kod Uc  Tahmininiz:"; cin >> GuessC;
    cout << endl;

    int GuessToplam = GuessA + GuessB + GuessC;
    int GuessÇarpım = GuessA * GuessB * GuessC;

    cout << "Girilen Kod:" << GuessA << GuessB << GuessC << endl;
    cout << endl;
    

    //Kazanma koşulları
    if (GuessToplam == CodeToplam && GuessÇarpım == CodeÇarpım)
    {
        cout << "***Dogru kod girildi. Bir sonraki asamaya gecildi.***\n";
        return true;
       
    }
    else
    {
        cout << "***Yanlis kod girdin, daha dikkatli olmalisin!!!***\n";
        return false;
    }
}



int main()
{
    srand(time(NULL));
    int LevelDifficulty = 1;
    const int MaxDifficulty = 5;

    while (LevelDifficulty <= MaxDifficulty)
    {
        bool bLevelComplete = PlayGame(LevelDifficulty);
        cin.clear();
        cin.ignore();

        if (bLevelComplete)
        {
            ++LevelDifficulty;
        }
        
    }

    cout << "\n***Tebrikler kalkis hazirliklari tamamlandi.***\n";

    return 0;
}

Privacy & Terms