Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do I get rid of the extra 4 at the end of the results? The actual input needs to match the expected input. Here

image text in transcribedHow do I get rid of the extra 4 at the end of the results? The actual input needs to match the expected input. Here is the code below:

#include

using namespace std;

void SelectionSort(int numbers[], int numbersSize) {

int i;

int j;

int k;

int temp;

for (i = 0; i

k = i;

for (j = i+1; j

if (numbers[j]

k = j;

}

}

temp = numbers[i];

numbers[i] = numbers[k];

numbers[k] = temp;

}

}

int main() {

int numbers[] = { 10, 2, 78, 4, 45, 32, 7, 11 };

const int NUMBERS_SIZE = 8;

int i;

cout

for (i = 0; i

cin >> numbers[i];

}

cout

cout

for (i = 0; i

cout

}

cout

SelectionSort(numbers, NUMBERS_SIZE);

cout

for (i = 0; i

cout

}

cout

return 0;

}

Test results: Test: 10 2 784 45 32 7 11 match Actual output Expected output 1 2 3 4 Enter eight unsorted numbers: UNSORTED: 10 2 78 445 32 7 11 SORTED: 2 4 7 10 11 32 45 78 W NP Enter eight unsorted numbers: UNSORTED: 10 2 78 445 32 7 11 SORTED: 2 4 7 10 11 32 45 78

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions

Question

Q.1. Taxonomic classification of peafowl, Tiger and cow ?

Answered: 1 week ago

Question

Q .1. Different ways of testing the present adulterants ?

Answered: 1 week ago

Question

Q.1. Health issues caused by adulteration data ?

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago