Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #pragma once
- using std::cout;
- using std::cin;
- using std::endl;
- #define TAB '\t'
- #define E2 cout << "\n\n"
- #define E4 cout << "\n\n\n\n"
- const int sz = 10;
- template <typename T>
- T printArray(T arr[]);
- template <typename T>
- T fillRandom(T arr[]);
- int raiseToPower(int a, int b);
- #include "Experimental.h"
- template <typename T>
- T fillRandom(T arr[])
- {
- for (int i = 0; i < sz; ++i)
- arr[i] = rand() % 100;
- return 0;
- }
- template <typename T>
- T printArray(T arr[])
- {
- for (int i = 0; i < sz; ++i)
- cout << arr[i] << TAB;
- return 0;
- }
- #include "Experimental.h"
- #include "functions.cpp"
- void main()
- {
- srand(time(NULL));
- float alpha[sz];
- fillRandom<float>(alpha);
- printArray<float>(alpha);
- E4;
- int a = 5, b = 5, tmp = 1;
- for (int i = 0; i < b; ++i)
- tmp *= a;
- /*cout << tmp << endl;*/
- cout << raiseToPower(5, 3) << endl;
- }
- //
- int raiseToPower(int a, int b)
- {
- int tmp = a;
- if (b > 0)
- return tmp *= raiseToPower(a, b - 1);
- else
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement