cout << setiosflags(ios::fixed) << setprecision(0)
<< endl << "The square root of "<< x << " is " << GetSquare(x)
<< endl <<endl;
by saying set precision (0) you have left no room for the...
Type: Posts; User: Susan
cout << setiosflags(ios::fixed) << setprecision(0)
<< endl << "The square root of "<< x << " is " << GetSquare(x)
<< endl <<endl;
by saying set precision (0) you have left no room for the...
well, i did that, sort of. my mistake perhaps was that I returned the value back to float after I rounded to the precision I wanted.
I have another post by susan that is a few below this one and...
interesting. don't quite know what to make of your observations. i'll make the similar changes and see what develops.
Well, i get the same as you, it works.
guess we need some name space...
have you tried
#include <string>
string stringname;
getline ( cin, stringname, termination character optional );
or
getline ( cin, stringname );
I was afraid of just the answer you gave! I rebooted and still had the same error. Does this mean that my compiler is corrupted in some way and I have to reinstall my compiler?
Susan
OK, I must be missing something. How can 0.00665 not equal 0.00665?
I hard code mytemp = 0.00665;
then i read in with cin >> searchValue to be 0.00665
then I test to see if they are equal (...
Hadn't thought of the delta. I tend to be very litteral and exact was my first instinct. Thanks for pointing out another way to go. Will consider this and save for future applications.
Thanks!
thanks S. C. and Tim, i'll give it a try.
I had the idea about multiplying by 100000 but i was looking at ceil() and had not considered floor(). neat trick. i like it.
now on to tim's part....
I have 2 floating point numbers with different significant digits.
I want to round a floating point number from
0.832557389... to 0.83256000... so i can compare it to another double that...
double did it. thanks
susan (and son)
I will try and make it a little more clear, I hope.
the number is in a string. it is 10 digits long. we want it to be the data type integer or long or what ever will hold it without going into E...
Hi,
We are trying to convert a string that has an IP address that we have taken the dots out of. So the string is now
"##########" (10 characters long where # = 0-9). we want to convert it to be...
thank you all very much. I miss PL1. that is how old of a programmer i am!
C++ - so many ways to do something that should be simple.
well, my son's program is running thanks to you all.
Happy...
tried this
cout << "/n this is chunk1 = " << ipchunk1.c_str() << endl;
Execution/run time error:
the instruction at 0x00422820 referenced memory at
0x00000000. The memory could not be...
How do i convert a string to a character array?
We are using a command line prompt like this:
int main(int argc, char **argv)
We put the argv into a string variable like this:
ipstring =...
Dear Shmulik,
Ya, hoo.
theString.erase(); worked perfect. I think that using.erase() is more explicit than just setting the string = to a null quote.
Thank you. I also wonder where...
Wish I could.
Thanks agian.
nite,
s
:)
Yea!!!!!!!!!
The simple answer is the best.
My prog. works great!
I tried all kind of things.
I tried myString = '\0' to clear it out and then it would not concatenate with another stirng.
...
HI,
I think you are looking for a way to show the decimal and trailing zeros.
You need
cout.setf (ios::fixed | ios :: showpoint);
cout.precision (2);
I just studied for a test on this very...
Hi,
My first time here.
I have a very old degee in CPS and am taking a C++ class and I want to clear my string. I don't want to
thestring = ' ';
because I want to concatenate other...