|
OK, I'm not aware of any function in the standard libs that'll do what you want. Also, if the number you specify is a double where does this comma come from? I mean the double number 46793233 would be 46,793,233. So I'm assuming the comma is always after the first digit? Either way, iterating through figures is a bit of a nightmare, and i'm not really sure of the best way to go about it, sorry.
|
|
|
|
|
In some countries they use the ',' intead of the '.'.
Example:
In America 4.67
In Italy 4,67
|
|
|
|
|
Interesting...why is that? The '.' is a decimal point to indicate decimal figures in a number, so why use a ','? Cheers for pointing that out to me though, I would never have guessed
|
|
|
|
|
A decimal point is an English notation. Most other countries use decimal commas, and the thousand separator is a period.
|
|
|
|
|
Dangleberry wrote:
Interesting...why is that? The '.' is a decimal point to indicate decimal figures in a number, so why use a ','?
Because it's the other way around in a lot of countries.
It can throw you at first, but it's something to keep in mind while on international forums.
|
|
|
|
|
This should work for you:
double a = 4.6793;<br />
a = a + 0.005;
int b = a * 100.0;
double c = b / 100.0;
|
|
|
|
|
Now I know what I'm doing, I'd do it like this :
//could make it a variable parameter so you don't have to keep supplying
//it with a param when you just want a standard round.
double rounddouble(double val, int fig=0)
{
//Avoid division by zero by checking fig for zero
if(fig != 0)
{
//get the multiply divide factor
double sigfig = pow(10, (double)fig);
//multiply the figure by 10pow to get the pos to chop the end off
val *= sigfig;
//add 0.5 before rounding so we round up or down
val += 0.5;
//adding 0.5 affects round down value in effect, rounding up or down.
val = floor(val);
//return the decimal to original value with chopped off rounded crap
val /= sigfig;
}
else
{
//just round the figure without an offset
val += 0.5;
val = floor(val);
}
//finally return the value
return val;
}
Hope this helps. This will return the correct rounded double value based on however many significant fig's you specify.
Alan.;P
|
|
|
|
|
I think this short scribble should work:
<br />
double round(double x, int digits)<br />
{<br />
double _int = (double)((int)x);<br />
double _pow = pow(10, digits);<br />
double _fract = (x - _int) * _pow;<br />
<br />
return _int + (_fract / _pow);<br />
}<br />
|
|
|
|
|
Very (more that too much) important thing in DCOM-
is to create transparent or easily incorporated
branch to Internet compatible -transports-
for real cases - most DCOM solutions is not workable
due to default firewall security and uneebility to work in
this comditions with not predefined client IE Browser.
That is many methods is possible:
DCOM -SOAP - DCOM
DCOM -SOAP - ELSE STUB like .NET,
due to method proxy-stab is same
(!- in methodology)
but realisation is different.
Just need to connect realisations.
Can you say -
Does such transport proxy stabs exists ?
|
|
|
|
|
I've set CEdit control property as Numeric, but its not accepting decimail.
Any suggesstions , it should accept numbers with decimal.
Warm Regards,
KKRam
|
|
|
|
|
No, it cannot! You'll have to make your own CEdit control. I made one, if you want I can send you the files. Just give me an e-mail adress.
|
|
|
|
|
hi moonen
Thanks for u r reply, u can send it to kamesh.kln@sify.com
Warm Regards,
KKR
|
|
|
|
|
You'll need a masked/formatted edit control. Plenty to pick from here:
http://www.codeproject.com/editctrl/
|
|
|
|
|
Hello all,
I'm having the following problem and can't figure out what's wrong:
the application I'm working on has a View class to print. When I call the OnPrintPreview, it gives a nice preview screen, nothing wrong. When I call the OnPrint, it prints, no problems. However, when I press the 'Print' button in the Preview, it does nothing; it just closes. No printer dialog, no error, nothing.
I find this very strange, obviously the printing code is ok, since it DOES print and it DOES preview. It only doesn't print from the preview screen...
Anyone got a suggestion?
Thanks,
- Fahr
|
|
|
|
|
I'm looking for optimized routines to convert double vectors <--> float vectors, etc. (optionally with non-unit increment)
Any links?
"Dor säggsische Dialeggt eechnet sich wie keeen onderor für den Ausdrugg zäärdlischor Gefiehle."
sighist | Agile Programming | doxygen
|
|
|
|
|
Hello, I am working with Microsoft embedded Visual c++. If I include afx.h in the dll code when I run the main program it fails at the begining, in the code generated by the appwizard. Does somebody know the solution? or it is not allowed including afx.h in a dll?
Thanks
|
|
|
|
|
Hi !
I'd like to do a nightly build of my application. We are several people working on the same project, so we want to compile our work during the night so that in the morning everyone has a 'fresh' application. To do that, we run a script which will use the MSDEV.exe in the command line to build the application. It works fine : I get an executable file. But, if I try to recompile from Visual Studio, using the obj files produced by MSDEV during the nightly build, I get errors telling me that the pdb file are in an obsolete format and the obj files are not readable.
Do you know any workaround for this bug ? How do you do your nightly build ? What I just want is that in the morning when I come to work, I don't have to rebuild all my application !
Thanks for our help !
Jerome
|
|
|
|
|
What's the exact command you are using? I do this all the time and have never seen this. Have you tried doing full rebuilds?
"Sucks less" isn't progress - Kent Beck [^]
Awasu 1.1.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Taka Muraoka wrote:
What's the exact command you are using?
msdev Sylvie.dsp /MAKE "ALL" /REBUILD /OUT Sylvie.plg
Jerome
|
|
|
|
|
This is what I use:
MSDEV.EXE ".\win32\XXX.dsp" /make all
I've got VC6 SP5 installed. Maybe that has something to do with it...
"Sucks less" isn't progress - Kent Beck [^]
Awasu 1.1.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Hi i have a dialog box where i have enabled the scroll bars by using the horizontal and vertical scroll bar check boxes in the dialog properties box
my question is how do actualy get the scroll bars so i can control them etc
im not able to give them an id so im not sure what thier ids are thats all i need to know how to get
thanks
|
|
|
|
|
Dialog with scroll bars are BAD.
|
|
|
|
|
Hi guys,
I want to control an IP camera from my program. The IP camera can be controlled through a web browser. Initially I captured the packets ( using Winpcap API calls) going from my machine to the IP camera, and again tried to send those packets to control the camera from my program. ( I established a TCP connection before sending those control packets). I couldn't get the result. Now my doubt is what I did is correct or not. Could any body guide me?? Any links on this may be helpful to me.
Thanks and Regards,
Satya
|
|
|
|
|
If it is controlled only through browser, it's enough to send correct http requests, which can be easily done by opening tcp connection to the device and sending the request. You should see then in captured data something like GET /image HTTP/1.0 followed by crlf and some set of headers, ended by 2*crlf
If there's some ActiveX or whatever that keeps separate tcp connection there can be a problem, that the protocol inside doesn't allow simple replaying, but I don't see a reason for doing that. Maybe that you just missed something or add some more data or whatever that your protocol differs from the protocol of device.
|
|
|
|
|
Hi
Thanks for ur reply. As you said, the http header is there in the captured packet. But what I did is I sent the data after the http (ended by 2 ctrlf) thinking as that payload is having the control signal. Beacause when I captured packets (in four directions top,left,bottom,right) they are differing only in the content after the http header.
So what I can do, any clues??
Regards,
SatyaDY
|
|
|
|