|
What is the datatype of variables "A" and "B"?
<br />
int A = 3;<br />
int B = 6;<br />
int result = B / A;
Did you write like that? if yes, result is INT. obviously.
or Show us the code that you wrote.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hello Michael,
Thanx for the reply, mate. I haven't written any code but what you have written is what I had in mind. The problem is how can I check to see if the result is NOT int. After all, I could have:
int A = 4;<br />
int B = 6;<br />
double result = B / A;
I simply wish to be able to knowwhen the result is integer and when it is not.
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
The result will always be an int when the remainder is zero
so check to see if B%A == 0
|
|
|
|
|
Hello Rocky,
Thank you very much, mate.
That was EXACTLY what I was looking for.
Have a great day.
Khoramdin
|
|
|
|
|
anytime mate
ur welcome...I'm glad ur happy
|
|
|
|
|
I think you just gave him the answer to his homework assignment.
|
|
|
|
|
so what is that a crime??
|
|
|
|
|
While the mod operator solved your problem, it's worth mentioning that B/A will always be an int, unless A is ( or is cast to ) a float or double.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
One trick you try is to see if there is a remainder using mod (%). Thanks.
modified 17-Jul-19 21:02pm.
|
|
|
|
|
If A = 15 and B = 3 ==> A%B = 0
If A = 17 and B = 4 ==> A%B != 0
V.
I found a living worth working for, but haven't found work worth living for.
|
|
|
|
|
Hi All,
Thank you for your time in advance.
I am doing remote desktop sharing project and now i can move the remote mouse but not being able to click the remote mouse from the client side(remote side). So please give some usefull hint. I need to fire the remote click event at the remote machine(to where i need to click the mouse) so that i can click on mycomputer or other application links and on other window as well. In this project we are using .net remoting technology.
thank you very much.
naresh dhami
naresh is testing the site.
|
|
|
|
|
|
Thank you very very much Michael. I feel you are the king of the Remote desktop sharing applications.
Actually we are developing remote deskotp sharing application different from the windows terminal service and vnc as well with respect to the architecture.
Thank you Thank you very much
naresh is testing the site.
|
|
|
|
|
all dudez,
i have a form which whenever i click the button, it will show
the data from database. someone told that i will use dataset and data adapter, the problem is i don`t know how to do it, im a newbie in c# nor programmings.
can anybody give me an examples or codes or sites that can make me understand well.
thanks in advance,
jeof
******************************
I just want to
know everything
|
|
|
|
|
C#Coudou wrote: the problem is i don`t know how to do it, im a newbie in c# nor programmings.
If you're new to C# and programming, you should learn some basics first instead of trying to interact with a database, etc.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
http://geekswithblogs.net/ranganh/archive/2005/04/25/37618.aspx
http://www.beansoftware.com/ASP.NET-Tutorials/DataSet-DataAdapter.aspx
http://msdn2.microsoft.com/en-us/library/bh8kx08z(VS.71).aspx
|
|
|
|
|
|
Hello everyone , first of all thank you for your time.
my question:
is it possible to make a key hooking method , that hook up which keys the
user is pressing while your program is running in the background?
i know its possible in c/c++....but no clue in c#
any tips , or links to articles , or a direct answer is welcome ,
thanks for all
Net
|
|
|
|
|
I think you'll get a lot of negative responses unless you give some idea why you would need to do that. Some people are inclined to think you're asking how to develop spyware.
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
there are CodeProject articles on subjects like these, if you care to search...
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
udikantz wrote: is it possible to make a key hooking method , that hook up which keys the
user is pressing while your program is running in the background?
i know its possible in c/c++....but no clue in c#
Which Hook are you talking about?
There are a lot of different hook types. (Ref: Window Hooks[^])
* WH_CALLWNDPROC and WH_CALLWNDPROCRET Hooks
* WH_CBT Hook
* WH_DEBUG Hook
* WH_FOREGROUNDIDLE Hook
* WH_GETMESSAGE Hook
* WH_JOURNALPLAYBACK Hook
* WH_JOURNALRECORD Hook
* WH_KEYBOARD_LL Hook
* WH_KEYBOARD Hook
* WH_MOUSE_LL Hook
* WH_MOUSE Hook
* WH_MSGFILTER and WH_SYSMSGFILTER Hooks
* WH_SHELL Hook
When I was working for test automation tool project, I used JournalRecord Hook and JournalPlayBack to record the users input as macro. You don't need to use C/C++ for that. All you need to do is that you need to find out how to use a few API in a particular language that you wanna use. I did one project in C# and another project in VB6.
Check-out this article for more details.
http://msdn.microsoft.com/msdnmag/issues/02/10/CuttingEdge/[^]
If you have some problems in using JournalRecord and JournalPlayback hooks, let me know.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
i am working on a project in which i hav to copy a .exe file to all the pcs' on the domain and the execute it with in a single loop, i used File.copy to copy and invoke psexec to exe cute the file, the problem is that psexec give file error bcoz the file is in use by copy command, when i restart the application the psexec execute the file that was copied when i first run the application
|
|
|
|
|
|
Is there an interop or P/Invoke (or are those the same?) call to ascertain the Win32 file version of a file? I want to list the version of all files in a directory, but some may not be .NET assemblies. How can I read this info?
Thanks.
|
|
|
|
|
Hi,
have a look at FileVersionInfo.GetVersionInfo(), it works for all kinds of files.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|