By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,797 Members | 1,794 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,797 IT Pros & Developers. It's quick & easy.

functional decomposition

P: 1
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
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 1,510
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
100+
P: 1,806
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

Post your reply

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