Jugwancommunication

Follow Us:

  • Home
  • News
  • FreeSoftware
  • OperatingSystem
  • ComptureLanguage
  • _Python
  • Faridabad Job's
HomeShortCode

C++

byYogesh Rajput -June 13, 2021
0
#include <iostream>
using namespace std;

class matrix
{
private:
    int a, b;
    int r,c;

public:
    void set()
    {
      int row, col, i, j;
        r = row;
        c = col;
        a = i;
        b = j;
        cin >> row;
        cin >> col;
        int arr[row][col];
        for (i = 0; i < row; i++)
        {
            for (j = 0; j < col; j++)
            {
                cin >> arr[i][j];
            }
        }
        cout << "Display" << endl;
        for (i = 0; i < row; i++)
        {
            for (j = 0; j < col; j++)
            {
                cout << arr[i][j] << " ";
            }
            cout << endl;
        }
    }
    virtual void get()
    {
        cout << "Class";
    }
};
class derived : public matrix
{
    void get()
    {
        cout << "This is virtual fun";
        int r, c, a, b;
        cin >> r;
        cin >> c;
        int arr[r][c];
        for (a = 0; a < r; a++)
        {
            for (b = 0; b < c; b++)
            {
                cin >> arr[a][b];
            }
        }
        cout << "Display" << endl;
        for (a = 0; a < r; a++)
        {
            for (b = 0; b < c; b++)
            {
                cout << arr[a][b] << " ";
            }
            cout << endl;
        }
        cout << "Sum Display" << endl;
        for (a = 0; a < r; a++)
        {
            for (b = 0; b < c; b++)
            {
                arr[a][b] = arr[a][b] + arr[a][b];
                cout << arr[a][b] << " ";
            }
            cout << endl;
        }
    }
};
;
int main(int argc, char const *argv[])
{
    matrix *ptr;
    derived d;
    ptr = &d;
    ptr->get();
    ptr->set();
    return 0;
}

Tags: ShortCode
  • Share on Facebook
  • Share on Twitter
You might like

If you have any doubts. Please Let me Know

Post a Comment

If you have any doubts. Please Let me Know

Post a Comment (0)

Previous Post Next Post

Follow Us

Advertisement

Main Tags

  • 16 GB RAM
  • 512GB SSD
  • 8 GB RAM
  • BestComputerCourses
  • Dell MS116 1000DPI USB Wired Optical Mouse
  • Excel
  • faridabadjob
  • Free_Software
  • HP 15 (2021) Thin & Light 11th Gen Core i5 Laptop
  • HP Pavilion (2021) Thin & Light 11th Gen Core i5 Laptop
  • Iris Xe Graphics
  • Java
  • JavaScript
  • MSOffice
  • Python
  • ShortCode
  • windows
  • Wired Keyboard and Mouse Combo with 104 Keys and a USB Mouse with

Featured post

Yogesh RajputSeptember 18, 2021

Advertisement

Tags

  • 16 GB RAM
  • 512GB SSD
  • 8 GB RAM
  • BestComputerCourses
  • Dell MS116 1000DPI USB Wired Optical Mouse
  • Excel
  • faridabadjob
  • Free_Software
  • HP 15 (2021) Thin & Light 11th Gen Core i5 Laptop
  • HP Pavilion (2021) Thin & Light 11th Gen Core i5 Laptop
  • Iris Xe Graphics
  • Java
  • JavaScript
  • MSOffice
  • Python
  • ShortCode
  • windows
  • Wired Keyboard and Mouse Combo with 104 Keys and a USB Mouse with

Pages

  • Terms and Conditions
  • Contact Us
  • JavaScriptTutorial
  • Today News

Advertisement

Contact Form