-
floats 'n integers
Code:
int gains;
for(i=1;i<=j;i++){
cout<<i<< " ";
gains = (amountY*interestR)/100.0f;
amountY = amountY + gains;
cout <<amountY << endl;
}
The problem here is that amountY and interestR have to be integers, becasue they were formmated as a character and I had to format them to a integer. But gains has to be a float. Is there a way to convert things to work correctly, that is mixing a float and integer? Can I convert char to float? Thanks
-
I can't see what you're asking here.
Code:
char x = 56;
float y = x;
y = 3.43f;
x = y; // Should give a compiler warning about loss of accuracy
Are you trying to interpret a string as a float, rather than as an integer like atoi?
-
basically yes, can I do that, and what function can I use?
-
-