473,503 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

functional decomposition

1 New Member
i'm taking a beginners programming class and im to write a program that gives the median of five input numbers.

problem is i have no clue what functional decompostion is. I'm using if else statements to find the median and the program is not compiling correctly.

Expand|Select|Wrap|Line Numbers
  1.     if (firstNum <=secondNum)
  2. {
  3.     if (secondNum<=thirdNum)
  4.         medianIs=secondNum;
  5.         cout<<"The Median is"<<secondNum;
  6.  
  7. }
  8.  
  9.      else if(firstNum<=thirdNum)
  10.      medianIs=thirdNum;
  11.      cout<<"The Median is"<<thirdNum;
  12.  
  13.  
  14.  
  15.     else 
  16.     medianIs=firstNum;
  17.        cout<<"The Median is"<<firstNum;
  18. }
  19.  
  20.  
  21.     if (thirdnum<=secondNum)
  22.  
  23.         medianIs = secondNum;{
  24.         cout<<"The Median is"<<secondNum;
  25. }
  26.     if(firstNumb<=thirdNum)
  27.      medianIs=firstNum
  28.      medianIs=thirdNum;
help.
Mar 17 '07 #1
2 3158
horace1
1,510 Recognized Expert Top Contributor
have a read thru
http://www.statcan.ca/english/edu/power/ch11/median/median.htm

which may give you some ideas of how to approach the problem
Mar 17 '07 #2
DeMan
1,806 Top Contributor
You can also search the forums and find whether a similar post may have been made before

Finding the Median of 5 numbers
Mar 18 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3206
by: JustSomeGuy | last post by:
I'm looking for c/c++/java/basic code for QR Decomposition. The numerical recipes code only handles square matrices.
2
4158
by: Jon Klingensmith | last post by:
Does anyone know where to find an implementation in C of the Dulmage-Mendelsohn decomposition of a sparse matrix, like the 'dmperm' command in MATLAB? Thanks, Jon klingej@bme.ri.ccf.org
25
2012
by: Michael S | last post by:
Hi. I just had a look at a J2EE-project that uses Maven all the way. All the way! Hence, by default, some kinda code-checker gives a red flag for a method being longer than 45 lines (and also...
60
4867
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the...
2
9271
by: eyh5 | last post by:
Hi, I'm wondering where I may get the C source code for a linear-algebraic technique known as the singular value decomposition (SVD). I found the code (a function called svdcmp) from...
3
1084
by: mano | last post by:
Hello.... Can anybody give me some idea ... How to write programs on (...(In C++)) Gauss elimination LU Decomposition finding Inverse Thanks
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4688
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
399
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.