Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdexcept>
- template <typename Tip1>
- void UnosBroja (std::string s1, std::string s2, Tip1 &n)
- {
- std::cout<<s1;
- std::cin>>n;
- if ((!std::cin) || (std::cin.peek()!='\n')) {
- std::cout<<s2;
- std::cin.clear();
- std::cin.ignore(1000, '\n');
- std::cin>>n;
- }
- }
- int main () {
- double x; int n;
- UnosBroja("Unesite prvi broj: ", "Pogresan unos!",x);
- UnosBroja("Unesite drugi broj: ", "Pogresan unos!",n);
- double b(x);
- for (int i=2; i<=n; i++) {
- x*=b;
- }
- std::cout<<"Rezultat: "<<x;
- return 0; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement