Subscribe Us

Responsive Advertisement

Advertisement

Debugging Exercise 9.2 oop

 

Debugging Exercise 9.2 oop




#include<bits/stdc++.h>

using namespace std;

class GST

{

    float price;

    float percent;

public :

    void input(float a,float b)

    {

        price=a;

        percent=b;



    }

    void print()

    {


        cout<<"price : "<<price<<endl;

        cout<<"percent "<<percent<<endl;

    }

};

int main()

{

   GST a;

    GST *p[3];

    GST *q;

    int i;


    q=&a;

    float s,t,f;

    for(i=0;i<3;i++)

    {

        p[i]=&a;

        cout<<"Enter price and percent :";

        cin>>s>>t;

        p[i]->input(s,t);

        cout<<"YOU enter : \n";

        q->print();


    }


    return 0;

}


Post a Comment

0 Comments