Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "string"
- #include "iostream"
- #include "vector"
- template<typename T,int N>
- class Array
- {
- private:
- T values[N];
- public:
- Array()
- {
- for (int i = 65;i < 65+N;i++)
- {
- values[i-65] = i;
- }
- }
- int getSize()const
- {
- return N;
- }
- T* getValues()
- {
- return values;
- }
- void printValues()
- {
- for (int i = 0;i < N ;i++)
- {
- std::cout << values[i] << " ";
- }
- std::cout << std::endl;
- }
- };
- template<typename T>
- void Print(T value)
- {
- std::cout << value << std::endl;
- }
- int main()
- {
- Print(1);
- //Print<int>(1);
- Print(1.1f);
- //Print<float>(1.1f);
- Print("jeden");
- //Print<std::string>("jeden");
- Array<std::string,26> arr;
- std::cout << arr.getSize() << std::endl;
- std::cout <<*(arr.getValues()+3) << std::endl;
- arr.printValues();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement