• Source
    1. #include "stdafx.h"
    2. #include <iostream>
    3. #include <string>
    4. template <typename Any>
    5. void get_object(Any object)
    6. {
    7. std::cout << object << std::endl;
    8. }
    9. template <typename Any, typename other>
    10. void get_object(Any object,other number)
    11. {
    12. for (int i = 0;i < number-1;i++) { std::cout << object << std::endl; }
    13. }
    14. void inc_used(int *used, std::string text)
    15. {
    16. *used++;
    17. get_object(text,*used);
    18. }
    19. int main()
    20. {
    21. int *used = new int;
    22. *used = 1;
    23. std::string *x = new std::string;
    24. std::cout << "What do you want to run?" << std::endl;
    25. getline(std::cin, *x);
    26. if (*x == "text")
    27. {
    28. get_object(*x);
    29. }
    30. else {
    31. inc_used(used, *x);
    32. }
    33. delete x;
    34. delete used;
    35. system("pause");
    36. return 0;
    37. }
    38.  
    39.