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 |
Explain high-order bytes.
HOW DO YOU HANDLE EXCEPTIONS IN C?
difference between c and c++?
What is a Deque?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
Given an array of length N containing integers between 1 and N, determine if it contains any duplicates.
write a program of bubble sort using pointer?
what will be the output of" printf("%d%d",scanf("%d% d",&a&b));"
What is a protocol in c?
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
what is c language.