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

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -