Автор - colser6686

Переставить элементы в обратном порядке c++

Ответ

Автор - MupoTBopec

#include "iostream"

#include "stdlib.h"

#include "locale.h"

using namespace std;


int main(){

setlocale(LC_ALL, "russian");

const int N = 10;

int A[N];

for(int i = 0; i < N; i++){

 cout << "Ââåäèòå [" << i << "] ýëåìåíò: "; cin >> A[i];

}

cout << "Ìàññèâ äî îáðàáîòêè" << endl;

for(int i = 0; i < N; i++){

 cout << "Ýëåìåíò [" << i << "] = " << A[i] << endl;

}

for(int i = 0; i < (N/2); i++){

    int temp = A[i];

 A[i] = A[N-i-1];

 A[N-i-1] = temp;

}

cout << "Ìàññèâ ïîñëå" << endl;

for(int i = 0; i < N; i++){

 cout << "Ýëåìåíò [" << i << "] = " << A[i] << endl;

}

system("pause");

return 0;

}

Ответы и объяснения

Сервис носит ознакомительный характер, вся информация, а в частности вопросы и ответы, которые задают и отвечают пользователи.
© 2025 Все права защищены Политика конфиденциальности Контакты
search points attachment profile arrow left arrow right star heart verified symbols equation arrow-down question mark check menu accountancyadministrationagriculturalalgebraallarabicartart_musicbelarusbelarus_altbiologybusinesscatalachemistrychineseeconomicsegzamenglishentrepreneurshipenvironmentethicseuskarafirst_aidfrenchgalegogeographygeologygeometrygermangrammarhealthhistoryindia_langindonesian_langinformaticsitalianjapanesekazachkazach_altkoreanlanguagelatinlawlife_scienceliteraturelogicmathematicsmusicnigerian_langother_languagesotherspedagogicsphilosophyphysical_educationphysicspoliticspsychologyreligionrpa_langrussianrussian_altsciencesecurityskillssocial_sciencesociologyspanishstatisticstechnologytourismtrafficukrainianukrainian_altukrainian_literaturewos_civilisation accountancyadministrationagriculturalalgebraall_1arabicartart_music_2belarusbelarus_altbiologybusiness_2catalachemistry_1chineseeconomicsexam_3englishentrepreneurshipenvironment_2ethicseuskarasecurity_1frenchgalegogeography_4geology_4geometrygermangrammarhealthhistoryindia-langindonesian-langinformaticsitalianjapanesekazachAsset 230koreanlanguagelatinlawlife-scienceliteraturelogic_2mathematicsmusicnigerian-langotherlanguagesother_1pedagogicsphilosophyphysical_educationphysicspoliticspsychologyreligion_1rpa-langrussianrussian_altsciencesecurity_3_mskills_1allsocial_science_5_msociologyspanishstatisticstechnologytourismtrafficukrainianukrainian_altukrainian_literaturewos_civilisation