Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <locale>
- #include <cmath>
- using namespace std;
- void inputArrAndCountSum(int* &arr, int n){
- arr = new int[n];
- cout << "Вводите массив:\n";
- for(int i = 0 ; i < n; ++i) cin >> arr[i];
- }
- double s(int *arr, int n){
- int sum = 0;
- for(int i = 0; i < n; ++i){
- sum+=arr[i]*arr[i];
- }
- return sqrt(sum);
- }
- int main()
- {
- int *a, *b, *c;
- int n[3] = {0};
- setlocale(LC_ALL, "");
- cout << "Размерность первого массива: ";
- cin >> n[0];
- inputArrAndCountSum(a, n[0]);
- cout << "Размерность второго массива: ";
- cin >> n[1];
- inputArrAndCountSum(b, n[1]);
- cout << "Размерность третьего массива: ";
- cin >> n[2];
- inputArrAndCountSum(c, n[2]);
- cout << "p = " << s(a, n[0]) + s(b, n[1]) + s(c, n[2]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement