Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C# (http://www.programmingforums.org/forum16.html)
-   -   c# (http://www.programmingforums.org/showthread.php?t=15083)

nick85 Jan 30th, 2008 1:08 AM

c#
 
Dear all sifu,
pls help me !! i duno how to do it


given these data sets:

departure city : KL, PJ, KLANG
arrival city : Penang, Kedah, Ipoh
stop by city : ipoh.

pls write a application in c# that generate all the possible departure
city-arrival city pair.
e.g., the result should have,
one way trip :
KL - Penang
KL - Kedah
KL - Ipoh
KL - Ipoh - Penang
...
round trip
-------------
KL - Penang - KL
KL - Ipoh - Penang - KL
...
all the possible routes must be saved in a file.
a console application is good enough.

hollystyles Jan 30th, 2008 5:15 AM

Re: c#
 
Two string arrays for the departure and arrival cities.
A string for the stop by city

then two nested loop:

write line "one way trip:"

Outer loop (for each departure city)....

Oooh oooh single funtion pass in param whether it's single or return flight! (hint String.Format())

Ah that's what it's like in my head, he he.

You must attempt some code first sorry, that's how it works here. I've given you some hints. Try some code even if it doesn't compile, have a go and post it here. Then we'll help you get it working.

nick85 Jan 30th, 2008 5:19 AM

Re: c#
 
thx!! but can u write code for me?

hollystyles Jan 30th, 2008 5:24 AM

Re: c#
 
Nope it's not allowed, you have to write and post some first. Then I will post any necessary additional or correcting code.

You might get lucky. Sometimes a forum member can't resist showing off and may post the complete solution, but I wouldn't hold your breath he he :)

nick85 Jan 30th, 2008 5:34 AM

Re: c#
 
thx!! but i wan to know izzit GUI application or command program!!

hollystyles Jan 30th, 2008 5:39 AM

Re: c#
 
Just do a command programme, also known as a Console programme.

nick85 Jan 30th, 2008 5:42 AM

Re: c#
 
actually i not really understand this question. can u explain for me. I also duno what to do it

OpenLoop Jan 30th, 2008 7:42 AM

Re: c#
 
This looks like a homework question. From my experience, homework comes from instructors. Last time I checked, instructors have office hours where students can go and ask questions like: "I don't understand what you're asking me to do".

Once you have that sorted out, we'll be glad to help you with the algorithm (which I believe hollystyles already covered).

hollystyles Jan 30th, 2008 7:57 AM

Re: c#
 
Quote:

actually i not really understand this question. can u explain for me. I also duno what to do it
You have posted in a C# forum, does your homework specify that C# is to be used ?

if yes:
Step 1.
Do you have the .NET framework 2.0 installed on a PC ?

Start -> Run.
Type: cmd
press enter
type cd "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"
press enter
type csc
press enter.

if no:
What language(s) are you allowed to use ?


The exercise involves these programing techniques:

Variables
Loops
Standard Output

These can be done in any language, it's just a matter of syntax and environment (computer and operating system) as to how you:

1. Write the source code
2. Compile/execute the programme

nick85 Jan 30th, 2008 8:11 AM

Re: c#
 
i need use c# to do it but i duno how to start it


All times are GMT -5. The time now is 3:54 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC