A
A
aalissia2019-03-02 18:03:36
C++ / C#
aalissia, 2019-03-02 18:03:36

How to write a program to determine the symmetry of a one-dimensional array of k elements?

That's all I could write, I can not understand further.
How to write that you need to compare the first and last elements in an array? Or is there another way to record such a program?

<
#include <iostream>
#include <math.h>
#include <iomanip>
using namespase std;
int main()
{
    int k,n,a;
    int numbers[a];
    cout<<"Vvedite razmer massiva"<<endl;
    cin>>k;
    if (k=1) 
    {
        cout<<"Vvedite chislo bolshe edenitsi"<<endl;
        return 1;
    }
    else
    if(k%2==0) k=n;
        for (i=0; i<=n;i++)
        {
            cout<<"Vvedite "<<i+1<<"-oe"<<endl;
            cin>>a[i];
        }
}  
 /code>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2019-03-02
@res2001

About the same as the definition of palindromes from this example (see the example at the end). You just need to replace strings with vectors.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question