|
<br />
int x = 0;<br />
int y = 0;<br />
int A = 0;<br />
int B = 0;<br />
int R = 0;<br />
<br />
Read x and y<br />
<br />
if (x >= y)<br />
{<br />
A = x;<br />
B = y;<br />
}<br />
else<br />
{<br />
A = y;<br />
B = x;<br />
}<br />
<br />
R = (A % B);<br />
<br />
while (R != 0)<br />
{<br />
A = B;<br />
B = R;<br />
R = (A % B);<br />
}<br />
<br />
Report "the GCD of x and y is B"<br />
Dave.
|
|
|
|
|
Hi all,
ColeDateTime m_starttime_ole,m_endtime_ole;
COleDateTimeSpan diff=(m_starttime_ole-m_endtime_ole);
int hour=(int)diff.GetTotalHours();
CString Value;
Value.Format(_T("%d"),hour);
AfxMessageBox(Value);
i m using this to get total hours.
it gives total hours 16,while actual total hours are 8.
please tell me correct way to calculate total hour diffrence between two timings.
please help me for this.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
"_$h@nky_" wrote: it gives total hours 16...
Which is correct, since 2/3 of a 24-hour day is ~16 hours.
Now if you really wanted a difference of 8 hours, you need to set m_endtime_ole to be one day after m_starttime_ole . As it stands, they are the same day.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Thanks
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hello every body
I've just down loaded visual studio 2008 C++ and is
only supports .NET. Is Microsoft hoping that the MFC with wither
and die.
Joe
|
|
|
|
|
If they did the same as they did for VC2005, the MFCs are not included in the express edition. You have to buy the standard edition in order to have the MFC's.
|
|
|
|
|
Jooooe wrote: Is Microsoft hoping that the MFC with wither
and die.
That has probably been the case since about 2002/2003. MFC still has a pulse but they have beaten it down pretty hard. We still use it for standalone apps as it has the most flexible structure and you get the sourcecode so you can tweak the MFC code out of tight spots.
If you buy the Professional Edition of Visual Studio 2008 and download the Visual C++ 2008 Feature Pack, you will find MFC has support for some new goodies like Office ribbons and the docking bars have gotten pretty advanced.
|
|
|
|
|
Jooooe wrote: Is the MFC dead
No its very healthy.
|
|
|
|
|
Jooooe wrote: Is the MFC dead
Nope. It is not free, however.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Jooooe wrote: Hello every body
Hi Doctor Nick! (reference[^])
If MFC was dead they'd give it to you free in the download
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How to open excel file in Windows mobile MFC application??
|
|
|
|
|
I've installed several key-logger on my system one after the other (not at the same time ). Almost all have worked correctly except one thing!
when the user types something in Microsoft Office programs like MS Word, each single character is registerd several times in the log file! for example if the user has typed the word "Hello World!", it's registered as "HHHHHeeeeellllllllllooooo WWWWWooooorrrrrlllllddddd!!!!!". I've already tried to design my own key-logger! but the same problem occured.
Thank you masters!
modified on Saturday, November 8, 2008 3:16 AM
|
|
|
|
|
This is a stab in the dark, but I'm guessing by key logger you mean a keyboard hook, and that you are reporting both WM_KEYDOWN AND WM_KEYUP.
Iain.
|
|
|
|
|
Yes, I meant Keyboard Hooks, and at least in my own app, I'm sure I was processing ONLY WM_KEYDOWN.
Thank you masters!
|
|
|
|
|
I want to know how to determine if the user is connected to the Internet or not. But I have a limitation, that's I MUST use pure Win32/64 API only. any help?
Thank you masters!
|
|
|
|
|
Try InternetCheckConnection[^] from the WinInet API. InternetAttemptConnect[^] might also serve you.
Stupidity is an International Association - Enrique Jardiel Poncela
Die deutsche Sprache sollte sanft und ehrfurchtsvoll zu den toten Sprachen abgelegt werden, denn nur die Toten haben die Zeit, diese Sprache zu lernen. - Mark Twain
|
|
|
|
|
Thank you very much ...![Rose | [Rose]](https://codeproject.global.ssl.fastly.net/script/Forums/Images/rose.gif)
|
|
|
|
|
|
Thank you for your reply ... ![Rose | [Rose]](https://codeproject.global.ssl.fastly.net/script/Forums/Images/rose.gif)
|
|
|
|
|
hi!
i want a sample for USB working, sending and recieving data to USB port
thank you
Zo.Naderi-Iran
|
|
|
|
|
Working with a USB is not like working with a serial port. You can't simply open the port and read/write data. Instead you have to get a handle from a device driver that is supplied with the device you want to communicate to.
So in brief, you never access the port directly but a driver and you never 'know' that you in fact access the USB port through the driver. You simply communicate with a driver. To get the handle, you have to use CreateFile and once you have the handle, you can write or read data using WriteFile/ReadFile. You can exchange driver specific information using DeviceIOControl.
All of these things are very specific to the driver (and device) you are accessing. So, if you want to information, you will need to be much more specific and tell us which device you want to access.
|
|
|
|
|
for example, an USB hard lock.
Zo.Naderi-Iran
|
|
|
|
|
On Cedric's behalf:
You need to read his message again - look at the website for the supplier of the hard lock (whatever that is). Usb is NOT like the serial port, you talk via device drivers. So you need the information from the supplier of whatever the device is.
Iain.
|
|
|
|
|
Hey all..
I need to draw PNG and some text on windows startup or when someone lock the computer.. It's Non MFC application.. Can someone throw light on approach?? I'm actually blank in that.. Just the start.
Thanks all..
|
|
|
|
|
Let me rephrase the question.. How do i draw picture (BMP or PNG) on window screen. Not Dialog Box.
And without MFC..
Thanks.
|
|
|
|