Click here to Skip to main content
15,914,795 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C++
#include<iostream>
#include<cmath>
float mean(float,float,float,float,float);
float sd(float,float,float,float,float,float);
using namespace std;
 main()
{
   float g,i,j,k,l,m;
   mean(i,j,k,l,m);
   sd(g,i,j,k,l,m);
   
   
}
float mean(float x1,float x2,float x3,float x4,float x5)
{
	float me;
	cout<<"Enter The Values Of X1, X2, X3, X4 & X5 , To Find The MEAN"<<endl;
    cin>>x1>>x2>>x3>>x4>>x5;
	me= (x1+x2+x3+x4+x5)/5;
    cout<<"Mean Is = "<<me<<endl;
    
	
}
float sd(float x,float x1,float x2,float x3,float x4,float x5)
{
	float y,sd;
		cout<<"Enter The Values Of X, X1, X2, X3, X4 & X5 , To Find The STANDARD DERIVATION"<<endl;
    cin>>x>>x1>>x2>>x3>>x4>>x5;
	x= (pow ((x1-x),2) + pow ((x2-x),2) + pow ((x3-x),2) + pow ((x4-x),2) + pow ((x5-x),2))/5;
	sd= sqrt(x);
	cout<<"Standar Derivation of Given Data Is = "<<sd<<endl;
}


What I have tried:

Can Anyone tell me how i can do that .
am trying to find MEAN & StANDARAD DERIVATION usin functions
i am trying to use the value of " mean " function into " sd " function
Posted
Updated 26-Feb-17 5:07am
v4

The same way you called the functions in your main.
 
Share this answer
 
Comments
Member 13024078 26-Feb-17 3:39am    
i have done it bro ...but this did't work
Graeme_Grant 26-Feb-17 3:58am    
pow is a method. So is your method mean. Basic programming level.
 
Share this answer
 
Comments
Graeme_Grant 26-Feb-17 4:01am    
I'm surprised that he hasn't noticed this week's coding challenge...
Quote:
How to use the values of one userdefine function into another user define function ? the code is given below .

User defined functions work exactly like any other functions. This is C++ 101.
C++
float g,i,j,k,l,m;
mean(i,j,k,l,m);
sd(g,i,j,k,l,m);

Those float variables are useless, looks like you try to use a magic that does not exist. It is so far away from the way it works, that it is complicated to guess what was the intend. Once again, this is C++ 101.

You should try to really learn how C/C++ works.

Here is links to references books on C and C++ by the authors of the languages. Note than C is the ancestor of C++, so knowing C is always useful with C++.
The C Programming Language - Wikipedia, the free encyclopedia[^]
https://hassanolity.files.wordpress.com/2013/11/the_c_programming_language_2.pdf[^]
http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.pdf[^]

C++ Programing Language[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900