Search google

Google
 

This is the place where I leave my scripts, my useful files, glad to have your suggestions. If you want to make discuss, please contact me at YM id bornbygoogle or my mail bornbygoogle@yahoo.com or simply let ur mail. I'll try to contact as soon as possible :) Nice to see you :D

Thursday, February 14, 2008

How to get a random number in C++ ?

This topic is going to guide how to get a random number in a C++ program : you need to include ctime and cstdlib.

This is an example :

#include (cstdlib) // Khong the su dung duoc <> nen danh dung ()
#include (ctime)
#include (iostream)

using namespace std;

int main()
{
srand((unsigned)time(NULL)); //Chổ này để khai báo sử dụng hàm rand() ở dưới
int d=rand()%12; //Chú ý con số 12 ha. Nghĩ xem nó là gì nha bạn :)
cout<< d;
}

No comments:

Convert Megaupload links to Rapidshare links !

If someone want to convert Megaupload to Rapidshare links, please let me know, I'll do it for you ! ( for free, all ). If you want, please send those links to me, with the mail title : Convert to Rapidshare !. My mail is bornbygoogle@yahoo.com. Or YM ID : bornbygoogle.

Nice to help you ! :)