dimanche 4 septembre 2022

How do I put the output of a rand function into a variable in C++?

I need to use the output of the rand function as a variable. I am not sure how to put the output of the rand function into int result. I want to put the output of the rand function into result.

srand(0);
for (int i = 0; i < 3; i++)
    std::cout << (rand() % 1) + 2;
std::cout << endl;
int result = 0;



Aucun commentaire:

Enregistrer un commentaire