isyae 0 Newbie Poster

can someone help me to do the friend function, i already do a coding a bit but i dont know how to continue. so i attached the instruction for referring

Screenshot_(250).png

#include<iostream>
using namespace std;

class studInfo{
    private:
        string name;
        int matric;

    public :
        studInfo(){
            matric=0;
        }
        ~studInfo(){
        }
        void getStudInfo();


};

class result:public studInfo{
    int res;
    int unit;
    int sem;
    int GPA;
    int CGPA;
    double totGP;
    double totunit; 
    public :
        result(){
            res=0;
        } 
        ~result(){
        }
        void getGPA(){
            GPA= totGP/totunit;
        }


    //declare friend function
    friend void academic(result&)   ;   
};

void studInfo::getStudInfo(){
    cout<<"Enter your name :";
    cin>> name;
    cout<<"Enter your matric no :";
    cin>> matric;

}
void academic(result&in){//friend function 

}


int main(){
    cout<<"\n\tWELCOME TO MY RESULT ACADEMIC PROFILE APLICATION (MYARPA)"<<endl;
    cout<<"======================================================================";
    cout<<endl<<endl;

    studInfo s;
    s.getStudInfo();

    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.