Professional Documents
Culture Documents
Exp7 4
Exp7 4
Exp7 4
h> int i=1; class linear { public: int var1,var2,v1,v2; linear() { v1=10; v2=10; } void accept() { cout<<"Enter the coefficient of x"; cin>>var1; cout<<"\nEnter the coefficient of y"; cin>>var2; } void d1() { cout<<"\n("<<i<<")z= "<<"("<<v1<<")x + ("<<v2<<")y"; } void find() { i=i+1; v1=v1+var1; v2=var2+v2; } }; void main() { clrscr(); linear l; cout<<"\nThe default equation is:\n"; l.d1(); cout<<"\nEnter the values for the new equation:\n"; l.accept(); l.find(); cout<<"The sum of both the equation is"; l.d1(); getch(); }
Page 1