c++ - Randomize blocks of code -
i pretty new c++ , need . there library or easy way randomize blocks of code each time compiling app ? example
struct{ float getnotes() { return something; } float getname() { return smth; } float getage() { return smths; } }students; into
struct{ float getage() { return smths; } float getname() { return smth; } float getnotes() { return something; } }students; and randomized everytime compiling . !!
in structure define functions can use them many works. note there isn't ordering functions.
if want works random, can use switch - case , create random number rand() function switch number. example :
srand(time(null)); int choice = (rand() % 10) + 1; // create random number between 1 , 10 switch(choice){ case 1: // or calling function break; case 2: // or calling function break; case 3: // or calling function break; .... .... .... } for more information read rand, srand, switch-case
good luck
Comments
Post a Comment