Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / November 2005

Tip: Looking for answers? Try searching our database.

Comparing numbers and determing the biggest.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
esparkman - 30 Nov 2005 22:49 GMT
Hey guys! 1st time poster here. Got a quick question. I'm just
beginning my journey into csharp and am developing a win32 app that
will retrieve a given useres account pull raw data from a db and
display that info. One of the things i need t odo is look at 7 entries
and compare those and then decide which is biggest and display that.
I am stuck. Can anyone help me out. I'm in no way asking for someone to

do this and me strip the code i would just like some very guided
directon. Any productive response would be awesome.
Peter Rilling - 30 Nov 2005 23:07 GMT
Not sure if there more to your problem that what a simple algorithm might
solve, but here is something that might work.  I just threw it together and
so I am not sure if it will work.

public int findLargest( params int[] numSet ){
   int largestFound = numSet[0];

   // This can be optimized so that first element is not eval since it was
initialized above.
   foreach( int num in numSet ){
       largestFound = Math.Max(largestFound, num);
   }

   return largestFound;
}

> Hey guys! 1st time poster here. Got a quick question. I'm just
> beginning my journey into csharp and am developing a win32 app that
[quoted text clipped - 5 lines]
> do this and me strip the code i would just like some very guided
> directon. Any productive response would be awesome.
raj - 30 Nov 2005 23:09 GMT
this is a simple approach
i will write psudocode and hope that  u can figure it all out
its extremely easy

variable currentNum = 0
variable largestFound = 0

take the very first # assign it to currentNum

while(we have more numbers)
{

if currentNum > largestFound
   largestFound = currentNum
currentNum = read next number

}

> Hey guys! 1st time poster here. Got a quick question. I'm just
> beginning my journey into csharp and am developing a win32 app that
[quoted text clipped - 5 lines]
> do this and me strip the code i would just like some very guided
> directon. Any productive response would be awesome.
esparkman - 30 Nov 2005 23:25 GMT
Thanks! Raj you is the man!

That is a much simpler approach.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.