Ribeiroo Posted June 28, 2021 at 07:23 PM Report Share #622790 Posted June 28, 2021 at 07:23 PM (edited) Boas pessoal a minha questão é a do titulo, é a única coisa que me falta. Alguém me conseguia ajudar? Obrigado #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]; arr[j+1]=aux; } printf("Os valores ordenados sao\n"); //escrever o array ordenado abaixo } Edited July 7, 2021 at 08:43 AM by thoga31 GeSHi Link to comment Share on other sites More sharing options...
thoga31 Posted July 7, 2021 at 08:45 AM Report Share #622894 Posted July 7, 2021 at 08:45 AM É a mesma coisa que o ciclo que tens com o scanf(), mas trocas por um printf(). Knowledge is free! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now