0

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

Edited by Stpdoug

2
Contributors
6
Replies
9
Views
5 Years
Discussion Span
Last Post by Stpdoug
0

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.

0

thanks for the reply here is the output code:

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

0

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?

Edited by Stpdoug

0

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.

Edited by Ancient Dragon

0

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

Edited by Stpdoug

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.