Thank for most who helped me to find out random fun before..
I am new to programming .. I just writing simple twenty one game..
Now my random out is like that ... k 5 6 q j .. mix char and int together randomly.. it might be suck..! now i want to add evth together to get some value (number) for twenty one game..BUT what i want is to set char with numerial value... like 'k'is 10. for example.. k +5 , the result be 17 etc.. how can set char with numberial value..here is some of my simple code..:lol:
int compcard=3,urcard;//urtotal=0,comptotal=0;
int num;
string randomChar = "kqja";
srand( (unsigned int)time( 0 ) );
cout<<"u want ?"<<endl;
cin>>urcard;
for ( int i = 0; i < urcard; i++ ) {
if ( rand() < RAND_MAX / 2 )
//in real, ur total .. have to put.. urtotal+=.....
cout << rand() % 10 + 1 << '\n';
else
cout << randomChar[rand() % randomChar.length()] <<endl;
}
}