View Single Post
  #1 (permalink)  
Old March 16th, 2007, 11:36 PM
xociology xociology is offline
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default need help! mean program

okay, so, im supposed write a program that gives the mean of three numbers. Problem is, i have no idea what im doing. The program doesnt compile and i dont know if i'm even doing this right.

any help would be greatly appreciated


// This program uses functional decomposition to determine the median // of three input numbers. The user can input the values in any order, // the program determines which value is between the other two.


#include <iostream>
#include <cstdlib>




using namespace std;
int main()

{
int firstNum;
int secondNum;
int thirdNum;
int medianIs;

cout<<"Enter three numbers";
cin>>firstNum>>secondNum>>thirdNum;
cin.ignore();



    if (firstNum <=secondNum)
    if (secondNum<=thirdNum)
        medianIs=secondNum;{
        }cout<<"The Median is"<<secondNum;

}

     else
     if(firstNum<=thirdNum)
     medianIs=thirdNum{
     cout<<"The Median is"<<thirdNum;

}

    else
    medianIs=firstNum;{
       cout<<"The Median is"<<firstNum;
}


    if (thirdnum<=secondNum)

        medianIs = secondNum;{
        cout<<"The Median is"<<secondNum;
}
    if(firstNumb<=thirdNum)
     medianIs=firstNum
     medianIs=thirdNum;



 return 0 ;
}


Reply With Quote