Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ sorts the array in order of smallest integer to largest. And format it to make it easier to read. #include stdafx.h #include #include using
C++ sorts the array in order of smallest integer to largest. And format it to make it easier to read.
#include "stdafx.h" #include
void main() { int array[10], t; for (int x = 0; x<10; x++){ cout << "Enter Integer No. " << x + 1 << " : " << endl; cin >> array[x];} for (int x = 0; x<10; x++){ for (int y = 0; y<9; y++){ if (array[y]>array[y + 1]){ t = array[y]; array[y] = array[y + 1]; array[y + 1] = t;}}} cout << "Array in ascending order is : "; for (int x = 0; x<10; x++) cout << endl << array[x]; return;}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started