daily pastebin goal
41%
SHARE
TWEET

Контрольная работа 2.0

PA33Ak Jun 19th, 2017 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. struct num
  6. {
  7.     double x;
  8.     int n;
  9. };
  10.  
  11.  
  12. double Power(num A)
  13. {
  14.  
  15.     double res = A.x;
  16.     for (int i = 1; i < A.n; i++)
  17.     {
  18.         res *= A.x;
  19.     }
  20.  
  21.     return res;
  22. }
  23.  
  24. int main()
  25.  
  26. {
  27.  
  28.     num A;
  29.  
  30.     A.x = 2.9;
  31.     A.n = 2;
  32.  
  33.     cout << "Power is: " << Power(A) << endl;
  34. }
RAW Paste Data
Top