samedi 17 décembre 2022

С++ I'm trying to make the randomizer lower and higher and bot [closed]

I'm trying to make a randomizer below and above and a bot that will pass itself, but I can't guess randomly, but the search is below and above


#include <iostream>
#include <Windows.h>

using namespace std;

int main()
{
    int NewNum = 100;
    int bin;
    int ran;
    int num;
    int guess;
    int tries = 0;

    srand(time(NULL));
    num = (rand() % 100) + 1;
    ran = (rand() % 100) + 1;

    cout << "12 let \n";

    do {
        cout << "1-100 \n";
        guess = 0 + ran;
        tries++;

        if (guess > num) {
            cout << "high \n";
            bin = 1;
            if (bin == 1) {
                ran = rand() % ran + 0;
            }
        }

        else if (guess < num) {
            cout << "low \n";
            bin = 0;
            if (bin == 0) {
                ran = ran + rand() % 100;
            }
        }
        else {
            cout << "correct: " << tries << "\n";
        }


    } while (guess != num);

    return 0;
}


I searched on the forums: Stackoverflow, Syberforum and so on, but my problem is not there, but there are similar ones, but I can't randomize below and above, but it seems to me that my randomizer is worse than just an ordinary randomizer. 🥲




Aucun commentaire:

Enregistrer un commentaire