Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- template <typename NumerickiTip>
- void UnosBroja(std::string s1, std::string s2, NumerickiTip &n)
- {
- std::cout << s1;
- while(!(std::cin >> n) || std::cin.peek() != '\n')
- {
- std::cout << s2;
- std::cin.clear();
- std::cin.ignore(10000, '\n');
- std::cout << s1;
- }
- }
- int main()
- {
- double x;
- int n;
- UnosBroja("Unesi prvi broj: ", "Neispravan unos!\n", x);
- UnosBroja("Unesi drugi broj: ", "Neispravan unos!\n", n);
- std::cout << pow(x, n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement