|
Pass the X and Y values to the constructors of Pointless.
Pass the instances of Pointless to the constructors of Line.
See the System.Console.WriteLine method for how to output.
|
|
|
|
|
Could you please show me how to do that?
|
|
|
|
|
You already know how, you actually had those parts right earlier.
|
|
|
|
|
I'm sorry I think my brain is fried I have no idea what you are talking about.
|
|
|
|
|
Your first example of Pointless had a reasonable constructor.
Your first example of Line took two Pointlesses as parameters, but didn't actually use them.
|
|
|
|
|
something like that?
also I get an "Unreachable code" warning on the Console.writeline, what am I doing wrong?
class Line
{
public double slope;
public Line()
{
reiknaslope();
}
private double reiknaslope()
{
Pointless pa;
Pointless pb;
pa = new Pointless();
pb = new Pointless();
return slope = (pb.pointY - pa.pointY) / (pb.pointX - pb.pointY);
Console.WriteLine(slope.ToString());
}
}
public Pointless()
{
X = 0;
Y = 0;
}
|
|
|
|
|
The line before it is returning from the method so it will never be reached.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Ok I got it, but it only writes out whole numbers, I remember there was some trick to write double values.
|
|
|
|
|
So do you have it working now?
|
|
|
|
|
I don't think my head can take much more banging on the desk.
The way I expect you will want to use these classes is:
Pointless p1 = new Pointless ( 2 , -4 ) ;
Pointless p2 = new Pointless ( -5 , 3 ) ;
Line l = new Line ( p1 , p2 ) ;
System.Console.WriteLine ( "{0: 0.00}" , l.Slope ) ;
Can you write your classes to work that way? I won't tell you how, you have all the ingredients.
modified on Thursday, January 22, 2009 5:03 PM
|
|
|
|
|
I wonder if Cooks share the same problem with people that want to be cooks. They have all of the ingredients, a picture of the end result, infinite documentation, and a ridiculous amount of time for trial and error yet the peanut butter and jelly sandwich still ends up tasting like gravel and looking like pudding.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
|
lol - I was tempted to code it, but managed to hold back - just. I did sketch out a rough 'flowchart' but decided not to post it at he's nearly there!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Slope of a line is basic math, not programming: (y1-y2)/(x1-x2)
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
He got that part hours ago.
|
|
|
|
|
Hello all,
I have created a DLL (smart device -> win32 application -> DLL) in Visual Studio 2005 and it can be compiled successfully using the Windows Mobile 6 SDK.
I try going to test my DLL by creating a new project (c#->device application -> wm6 application) and add the DLL to it. I tried dragging the DLL into application it works, but it doesnt work when I tried to add reference to it However, whenever I try building the project on simulator, it says it cannot find the DLL.
Funny enough, when I directly put the application exe and the dll to my device, it works. But I observe that my DLL library is not performing what it should be.
What is the problem with it ? Assistance of any forms will be highly appreciated.
Thanks,
Leslie
|
|
|
|
|
It sounds like the DLL isn't being copied over to the device when you are testing. What exactly do you mean by
leslie wu wrote: I tried dragging the DLL into application it works, but it doesnt work when I tried to add reference to it
If there isn't a reference to the DLL in the project, I doubt VS will know to copy it over when testing.
Edit : Also, what sort of DLL is it (is it, for example, a .Net Assembly)?
|
|
|
|
|
Hi Tony,
Thank you for your reply. What I mean by that is if I drag my compiled DLL from windows explorer directly into the the solution explorer space, I can see the DLL copied into the project.
However, if I try adding by clicking: my project -->"add reference" and add my DLL,it says " A reference to mydll could not be added.
What is the problem with it ? What should be the proper way in adding my DLL ?
And to my second problem concerning my dll function is not working properly, any clue ?
Thanks,
Leslie
|
|
|
|
|
To be precise, I got the following error:
An unhandled exception of type 'System.MissingMethodException' occurred in DeviceApplication2.exe
Additional information: Can't find PInvoke DLL 'smartdevicedll.dll'.
|
|
|
|
|
That is a versioning error, usually.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
Got it ...you need to use Window CE Remote File Viewer to look at the path..
Everything sorted..thanks everyone !!!
|
|
|
|
|
Hi everybody,
I've got a potential customer that would like a C# GUI that interfaces with an SQL server somewhere. So, I'm trying to figure out where to start. Don't know a ton about SQL, but it looks like this guy is just wanting some basic INSERT and SELECT functions done on a table.
I took a look at this article http://www.codeproject.com/KB/database/sql_in_csharp.aspx[^] and see that it's a good start. However, I've got some questions that need to be addressed first:
1) No idea if this makes a difference, but if the SQL server is running behind a firewall or a router, how do I get to it? Is it something like inputting an IP address/port combination, username and password?
2) How can I get a server to test my program on locally that I have control of? I don't want to be using a (hopefully not) buggy program on someone else's server
Thanks for entertaining a complete noob about SQL.
Take care,
Michael Fritzius
|
|
|
|
|
1) There are many options. Today the most notable is to place one or more web services behind the firewall and use them to interface with from the client.
2) I don't understand the question. How do you get a server?
led mike
|
|
|
|
|
led mike wrote: 2) I don't understand the question. How do you get a server?
I meant how to get an SQL server running someplace. Something with a database on it that I can run my program against to check and see that the correct info is being added/read at the server. What would you recommend?
|
|
|
|
|
Install either MySQL server or MSSQL express, both are free and you won't have to worry about firewalls and what not. You can learn how to interact C# and SQL easily here.
Good luck!
|
|
|
|