@Samuel_Anjam:


Well, ofcourse it will always output 1.14937... when you call the function you dont send it the variables, you send it "1.0". (That, and you forgot the ".h" on iostream.h) (And a few other minor things)

Code:
 
michael_calculation(1.0,1.0,1.0);
should be
michael_calculation(x,y,z);



Here is the corrected code...
Code:
#include <iostream.h>
#include <math.h>

void michael_calculation(double x, double y, double z)
{
double temp = sqrt(x*x+y*y*cos(y)/sin(x)*z*z+y*y)/sqrt(2);
cout << temp;
}
void main()
{
double x = 0;
double y = 0;
double z = 0;
cout << "Please enter a number for x: ";
cin >> x;
cout << "Please enter a number for y: ";
cin >> y;
cout << "Please enter a number for z: ";
cin >> z;
michael_calculation(x,y,z);
}



The new code will now return different results based on user input. Not quite sure if this now makes it 'useful' or not though.

--------------------------

Cheers,
AMan

Last edited by AMan; 03/24/06 06:15.