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 |
write the program for maximum of the following numbers? 122,198,290,71,143,325,98
which is an algorithm for sorting in a growing Lexicographic order
fun(int x) { if(x > 0) fun(x/2); printf("%d", x); } above function is called as: fun(10); what will it print? }
Explain how do you determine whether to use a stream function or a low-level function?
What is null character in c?
how to devloped c lenguege?
while running a program, i got the msg that press return key to exit.what that mean in C as there are no such options as far i know.
What is 2c dna?
Why cann't whole array can be passed to function as value.
Explain how can I open a file so that other programs can update it at the same time?
What is the memory allocated by the following definition ? int (*x)();
main() { int a[3][4] ={1,2,3,4,5,6,7,8,9,10,11,12} ; int i, j , k=99 ; for(i=0;i<3;i++) for(j=0;j<4;j++) if(a[i][j] < k) k = a[i][j]; printf("%d", k); }
4 Answers Vector, Wipro, Zoho,