Hi, I need to be pointed towards the correct way to express,
a greater percent chance of something happending.
For example:
a and b are playing cards and a has a 60% chance of winning.
and the wins are generated by rand.(got that part) it's just
the percentages
Thanks
Michele
i thought that by assigning them to the initialization of the int of each it would work, but i cannot tell if it is...is it?Code:#include<iostream> #include<cstdlib> #include<ctime> #include<iomanip> #include<iostream> #include<fstream> using namespace std; //function prototype int pp (int&); int score = 0; void main() { ofstream outfile("A:\\0F1017_6_2.txt"); if(!outfile){ cerr << "Cannot open output file" << endl; } srand((unsigned) time(0)); int a = 0(.56); int b = 0(.44); int aa = 0; int bb = 0; ............................ //my function is: int pp (int &score) //function pp {score = ( rand() % 2); return score;}
should i be expressing the chances in the random expression of the function?
thanks Michele/scuba22



LinkBack URL
About LinkBacks



