is the a code to say to randomly goto a line between 2 lines like 100 and 200 expect for 104 and 304 and a bunch of other specefic lines. is this possible
is the a code to say to randomly goto a line between 2 lines like 100 and 200 expect for 104 and 304 and a bunch of other specefic lines. is this possible
look in the tutorial section of this site for random numbers, look on the web for random numbers, SEARCH THIS BOARD FOR RANDOM NUMBERS!!!
This question has been asked a million and one times.
if that's not enough information, go to google and search for "problem solving tutorials"
U.
Quidquid latine dictum sit, altum sonatur.
Whatever is said in Latin sounds profound.
Get a random number. From there, use the random number in a switch statement, and call different functions in each case.
what? how about this you might understnad it bette,r i need a code to say to give a number to a varible like it randomly chooses a number between 100 and 200 besides smoe certina numbers. then go to the line with that number life if it chose 132 it goes to linme 132. can someone make a sameple cpp file for doign this or asomething similar.
Here is a snippet of the code
int ln;
srand(time(0));
ln = rand()%100+200;
goto ln;
I think thats right.
Just try it, you never know.
tudehopet uses Borland Compiler 5.5
and Visual C++ 6.
> then go to the line with that number life
please people, proofread your posts to make sure they make sense!
do you mean execute some line of code? jump to a certain line in a file? we are not mind readers
i need a code to picka random number inbatween two numbers than give it to a varible. thats the best way i cant explain it
This might satisfy your needs.
Code:#include <stdlib.h> #include <iostream.h> #include <time.h> int function(int*,int,int); int main() { int variable=0; srand( (unsigned)time( NULL ) ); variable = function(&variable,100,200); cout << variable; return 0; } int function(int* variable, int lower, int upper) { return (*variable = upper - (rand()%(upper-lower)+1) ); }
variable = function(&variable,100,200);
sorry 'bout that, should've been
function(&variable,100,200);