Hey guys i am having a small problem with this calculation in bold:

amtwon = (pow(pbet,2) / pow(pbet,2-100 *pbet)) ;
amtlost = ( 0.35 * pbet);
totalwin = (amtwon - amtlost);

this is the block of code.the problem is amtwon totalwin is supposed to return a value of 23.993.18 but i am seeing 1.# inf when calculated what the heck am i doing wrong.
mind you i multiplied the pbet variable by it self and it worked...ps i am using "double" for all these values

Recommended Answers

All 6 Replies

If you are printing the results to the screen, post the code that prints it. It might be just a display problem instead of a problem with the data.

thanks for the reply here is the output code:

cout << "\nTotal Winnings: " << totalwin <<endl<< endl ;

try cout << fixed << totalwin

wow thanks that worked prefectly is there any way i can limit the decimal places? one more thing say i want to put an boxed outline around the the result of the calculation how would that be done?

is there any way i can limit the decimal places?

setprecision() should do it.

i want to put an boxed outline around the the result of the calculation how would that be done?

print the extended ascii codes, see this chart. That assumes you are using standard English ascii char set that is installed with MS-Windows os.

hey thanks man it works perfect going to look up the ASCII

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.