Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- #include <string>
- #include <cstdlib>
- using namespace std;
- void countandwrite(double *arr, int how)
- {
- string str, strl;
- double last;
- for (int i = 0; i < how; i++)
- {
- str = to_string(int (pow(arr[0, i], arr[1, i])));
- cout << "Power:" << str << endl;
- strl = str.back();
- last = stod(strl);
- cout << "Last character:" << last << endl;
- }
- }
- int main()
- {
- int how;
- cout << "Number of powers:";
- cin >> how;
- double *arr;
- arr = new double[2, how];
- for (int j = 0; j < how; j++)
- {
- cout << "Number:";
- cin >> arr[0, j] >> arr[1, j];
- cout << endl;
- }
- countandwrite(arr, how);
- delete[]arr;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment