#include<iostream.h> class Number { int Num; public: Number(int x = 0) { Num = x; } void Display(void) { cout<< Num; } void Modify(); }; void Number::Modify() { int Dec; Dec = Num % 13; Num = Num / 13; if(Num > 0 ) Modify() ; if(Dec == 10) cout<< "A" ; else if(Dec == 11) cout<< "B" ; else if(Dec == 12) cout<< "C" ; else if(Dec == 13) cout<< "D" ; else cout<< Dec ; } int main() { Number objNum(130); objNum.Modify(); return 0; }
#include<iostream.h> class CuriousTab { int x, y; public: CuriousTab(int xx = 10, int yy = 20 ) { x = xx; y = yy; } void Display() { cout<< x << " " << y << endl; } ~CuriousTab() { } }; int main() { CuriousTab objCuriousTab; objCuriousTab.Display(); return 0; }
#include<iostream.h> class CuriousTabBase { public: float x; }; class CuriousTabDerived : public CuriousTabBase { public: char ch; void Process() { ch = (int)((x=12.0)/3.0); } void Display() { cout<< (int)ch; } }; int main() { class CuriousTabDerived *objDev = new CuriousTabDerived; objDev->Process(); objDev->Display(); return 0; }
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.