Program for inheritance by loop and class for table in c++

 Que - Table program by inheritance and class

#include<iostream>

using namespace std;


class loop

{

   protected:

   int a,b;


};

class second: public loop

{

   public:

void table()

{

cout<<"enter a number :- ";

   cin>>b;

   for (a=1; a<=10; a++)

{

      cout<<b<<"×"<<a<<"="<<b*a<<endl;

}

}

};

int main()

{

   second ob;

   ob.table();

  return 0;

}

Output:-



Post a Comment

Previous Post Next Post