- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
hello c++ pros, iam a c++ beginner please help me with this code..iam unable to get the proper out put.In the above class i have tried to imitate String class and overloaded few operators. I got strucked up as show() method above was unable to print "t3" string properly.Please help … |
|
[CODE]#include<iostream.h> class alpha { int x; public: alpha(int i) { x=i; cout<<"\n alpha constructor"; } void show_alpha(void) { cout<<"x="<<x<<"\n"; } }; class beta { float p,q; public: beta( float a,float b):p(a),q(b+p) { cout<<"\n beta constructor"; } void show_beta(void) { cout<<"p="<<p<<"\n"; cout<<"q="<<q<<"\n"; } }; class gamma:public beta,public alpha { int u,v; … |
|
[CODE]#include<iostream.h> class invent2 class invent1 { int code; int items; float price; public: invent1(int a,int b,float c) { code=a;items=b;price=c; } void putdata() { cout<<"code:"<<code<<"\n"; cout<<"items:"<<items<<"\n"; cout<<"value:"<<price<<"\n"; } int getcode(){ return code; } int getitems() { return items; } float getprice() { return price; } operator float(){ return(items * code); } … |