fork download
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstdlib>
  4. using namespace std;
  5.  
  6. class Data
  7. {
  8. public:
  9. Data(unsigned d, unsigned m, unsigned y): d(d), m(m), y(y) { ; }
  10.  
  11. char* display(char* buf)
  12. {
  13. sprintf(buf, "%u-%u-%u", d, m, y);
  14. return buf;
  15. }
  16.  
  17. private:
  18. unsigned d, m, y;
  19. };
  20.  
  21. int main()
  22. {
  23. char buffer[20];
  24. Data d(10, 20, 1990);
  25. cout << d.display(buffer) << endl;
  26. return 0;
  27. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
10-20-1990