Laitofai

16

May 14th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     setlocale(LC_ALL, "rus");
  9.     cout << "Введите размер массива: ";
  10.     int n;
  11.     cin >> n;
  12.     if(n % 2 == 1){
  13.         cout << "Массив не может быть нечетного размера";
  14.         return 0;
  15.     }
  16.     double arr[n];
  17.     cout << "Вводите аргументы, затем значения функции: " << endl;
  18.     for(int i = 0; i < n; i++){
  19.         cin >> arr[i];
  20.     }
  21.     cout << "  x    y(x)" << endl;
  22.     for(int i = 0; i < n / 2; i++){
  23.         cout << setw(5) << arr[i] << setw(5) << arr[i + n / 2] << endl;
  24.     }
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment