#Getting a error in class idk why

1 messages · Page 1 of 1 (latest)

storm berry
#
#include<iostream>
using namespace std;
class my{
    int a;
    int b;
    friend my func2(int x, int y);
    public:
        void func1(void){
            cout<<"Enter a number "<<endl;
            cin >> a;
            cout<<"Enter another number "<<endl;
            cin >> b;
        }
};

my func2(int x, int y){
        int h=x+y;
        
        return h;
}            
                        
                                    
                                                
                                                            
                                                                        
                                                                                    
                                                                                                            
int main(){
        my n;
        n.func1();
        int z= func2(n.a,n.b);
        cout<<z;
    
    
    
    
    
    
    
}``` I cant understand the error in compling time plese explain i am new in c++
mighty wagonBOT
#

<@&987246683568103514> please have a look, thanks.

mighty wagonBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

storm berry
#

solved

#

i was doing the format wrong