|
-
Mar 7th, 2002, 03:56 PM
#1
srand
does anyon know how to use the srand function? i have to generate a rndom number for a math prblem btwn 1..10 but i want them to be different everytime. i understand srand does this but i cat get it to work.
heres what i have
cout<<"generating random numbers between 1 and 10.....\n";
temp1 = tempA+double(rand())*((tempB-tempA)/RAND_MAX);
temp2 = tempA+double(rand())*((tempB-tempA)/RAND_MAX);
cout<<"\nThe first number is "<<temp1;
cout<<"\nThe second number is "<<temp2<<"\n";
cout<<"\nCan you figure out "<<temp1<<oper<<temp2<<" ?\n";
cin>>UserAns;
system("CLS");
return 0;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|