Example of friendly function in c++
Answers were Sorted based on User's Feedback
Answer / harry0009
#include<iostream.h>
class sample
{
int a,b;
public:
void setvalue()
{
a = 25;
b = 45;
}
friend float mean(sample s);
};
float mean(sample s)
{
return(float(s.a+& b)/20);
}
void main()
{
sample ;
x.setvalue
cout<<"mean value"<<mean(x);
getch();
}
Is This Answer Correct ? | 11 Yes | 4 No |
What character terminates all strings composed of character arrays? 1) 0 2) . 3) END
difference between malloc and calloc
why you will give me a job in TCS.
How do you convert strings to numbers in C?
Is there any possibility to create customized header file with c programming language?
What is a 'null pointer assignment' error?
how does the C compiler interpret the following two statements p=p+x; q=q+y; a.p=p+x; q=q+y b.p=p+xq=q+y c.p=p+xq; q=q+y d.p=p+x/q=q+y
hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .
0 Answers Aegis, CDAC, Infosys,
Explain what is the most efficient way to store flag values?
what are the files which are automatically opened when a c file is executed?
The variables are int sum=10,SuM=20; these are same or different?
Explain how do you convert strings to numbers in c?