RSS Forums RSS
Please support our C++ advertiser: Programming Forums

smallest largest

Join Date: Mar 2008
Location: UK - Lymm
Posts: 535
Reputation: williamhemsworth is just really nice williamhemsworth is just really nice williamhemsworth is just really nice williamhemsworth is just really nice 
Rep Power: 5
Solved Threads: 49
williamhemsworth's Avatar
williamhemsworth williamhemsworth is offline Offline
Posting Pro

Re: smallest largest

  #9  
May 12th, 2008
Or without any logical operators:

int min3(int a, int b, int c) {
	for (int i = 0;; i++) {
		if (!(a - i)) return a;
		if (!(b - i)) return b;
		if (!(c - i)) return c;
	}
	return 0;
}
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:09 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC