• 0
Sign in to follow this  
Vinicius Lima

Selection sort


Boa noite, eu estou tentando fazer uma função que ordene os itens de um vetor através do método selection sort. Sempre que eu executo, ele pula o número 9 do meu vetor. Alguém pode me ajudar a identificar o erro?

#include <iostream>
using namespace std;

void select(int vet[], int tam);

int main() {
    int tam=10;
    string v;
    int notas[tam]={9,2,5,3,8,4,7,1,6};

    for(int x=0;x<tam;x++){
        cout<<"Antes do select: " <<notas[x]<<"\n";

    for(int x=0;x<tam;x++){
            cout<<"Depois do select: " <<notas[x]<<"\n";

    return 0;
void select(int vet[], int tam){
    int x, y, troca, aux;

Eu já achei o erro ;-;


Eu já achei o erro ;-;


Share this post

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this