G
G
grecigor2020-12-12 22:46:51
C++ / C#
grecigor, 2020-12-12 22:46:51

A sequence that has paired elements and is unpaired numbers, what should be added?

In paired array elements, output unpaired numbers does not work.

I threw off the code where it displays only paired elements, but I don’t know how to do it with unpaired numbers.

#include <iostream>
#include <ctime>
using namespace std;

double func(int *A,int a){

    for (size_t i = 0; i < a; ++i) {
        if (i % 2 == 0){
           
        }
    }

  return 0;
}

int main() {


    int a;
    cout<<"Введите количество членов последовательности"<<endl;
    cin>>a;

    int* A = new int[a];

        cout<<"Вывод вашей последовательности чисел"<<endl;
    for (int i = 0; i < a; ++i) {
        A[i] = rand() % 10;
        cout<<A[i]<<" ";
    }
    cout<<" "<<endl;

cout<<" Вывод последовательности которые имеют  непарные числа и находятся в парных местах= "<<func(A,a)<<endl;



    return 0;
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question