Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Задача 4,2.cpp: определяет точку входа для консольного приложения.
- //
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- double power(int a, int b)
- {
- int i = 1;
- double c = a;
- if (b != 0)
- {
- while (i < b)
- {
- i++;
- c = c*a;
- }
- return c;
- } else return 1;
- }
- int main()
- {
- double a, b;
- setlocale(LC_ALL, "russian");
- cin >> a >> b;
- cout << power(a, b) << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment