Jump to content

Escrever o array ordenado e mostrar resultado no ecrã


Recommended Posts

Boas pessoal a minha questão é a do titulo, é a única coisa que me falta.

Alguém me conseguia ajudar?


#include <iostream>
#include <stdlib.h>

const int  max = 6;
int main() {
    int arr [max], aux;
    printf("escreva %d valores\n", max);
    for (int i = 0 ; i < max; i++) {
        scanf("%d", &arr[i]);
    for(int i = 0; i < max; i++)
    for (int j=0; j<max -1-i; j++)
    if (arr[j]> arr[j+1]) {
        aux = arr[j];
        arr[j]= arr[j+1];
    printf("Os valores ordenados sao\n");

//escrever o array ordenado abaixo

  Edited by thoga31
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.