#include<iostream.h> class CuriousTab { int x; float y; public: void Function() { x = 4; y = 2.50; delete this; } void Display() { cout<< x << " " << y; } }; int main() { CuriousTab *pCuriousTab = new CuriousTab(); pCuriousTab->Function(); pCuriousTab->Function(); pCuriousTab->Display(); return 0; }
#include<iostream.h> #include<string.h> class CuriousTab { char str[50]; char tmp[50]; public: CuriousTab(char *s) { strcpy(str, s); } int CuriousTabFunction() { int i = 0, j = 0; while(*(str + i)) { if(*(str + i++) == ' ') *(tmp + j++) = *(str + i); } *(tmp + j) = 0; return strlen(tmp); } }; int main() { char txt[] = "Welcome to CuriousTab.com!"; CuriousTab objCuriousTab(txt); cout<< objCuriousTab.CuriousTabFunction(); return 0; }
#include<iostream.h> #include<string.h> class CuriousTab { char txtMsg[50]; public: CuriousTab(char *str = NULL) { if(str != NULL) strcpy(txtMsg, str); } int CuriousTabFunction(char ch); }; int CuriousTab::CuriousTabFunction(char ch) { static int i = 0; if(txtMsg[i++] == ch) return strlen((txtMsg + i)) - i; else return CuriousTabFunction(ch); } int main() { CuriousTab objCuriousTab("Welcome to CuriousTab.com!"); cout<< objCuriousTab.CuriousTabFunction('t'); return 0; }
#include<iostream.h> class CuriousTabData { int x, y, z; public: CuriousTabData(int xx, int yy, int zz) { x = ++xx; y = ++yy; z = ++zz; } void Show() { cout<< "" << x++ << " " << y++ << " " << z++; } }; int main() { CuriousTabData objData(1, 2, 3); objData.Show(); return 0; }
class CuriousTab { public: static void MyFunction(); }; int main() { void(*ptr)() = &CuriousTab::MyFunction; return 0; }
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.