Untitled

mail@pastecode.io avatar
unknown
plain_text
11 days ago
494 B
0
Indexable
Never
#include<iostream>
using namespace std;
class nest  {
int a;
int square_num() {
return a*a;
}

public:
    void input_num() {
    cout<<"Enter a number: "<<endl;
    cin>>a;
    }

    int cube_num() {
    return a*a*a;
    }
    void disp_num() {
    int sq=square_num();
    int cu=cube_num();
    cout<<"The square of " <<a<<" is " <<sq<<endl;
    cout<<"The cube of "<<a<<" is "<<cu;
    }
};


int main() {
nest n1;
n1.input_num();
n1.disp_num();
return 0;
}
Leave a Comment