# Programming Rounding Numbers

Show 80 post(s) from this thread on one page
Page 2 of 2 First 12
• 10-30-2005
mikeprogram
I got what you meant, but still takes time to give an answer, I dont know now what is the problem but I have one solution to the problem. Thank you.

Code:

#include<iostream>
using namespace std;

#include<cmath>

double roundtohundreths (double);
int main()
{
char t = 'Y';
double x;
while( t != 'N' && t != 'n' )
{
if ( t == 'Y' || t == 'y' )
{
cout << "Enter number: ";
cin >> x;
while( char() != '\n' );
cout << "Original value is: " << x << endl;
cout << "Rounded number is: " << roundtohundreths( x ) << endl;
}
cout << "Type Y for entering a number ( N to end ): ";
cin >> t;
char t += t = 'Y' // im not sure whether to add this to

}
return 0;
}
double roundtohundreths (double a)
{
double roundto = floor( a * 100 + .5 ) / 100;
return roundto;
}

• 10-30-2005
mikeprogram
SlyMaelstrom and Xipher:

Problem solved thanks to your wonderful help. You made me challenge to the limit. I read your comments three or four times before realizing my mistake, but sincerely thank you to both of you. Your excellent programmers. Enjoy the extra hour from the DST time.

Good night,
;) ;)
Show 80 post(s) from this thread on one page
Page 2 of 2 First 12