dimanche 10 mars 2013


Exercice en C++corrigé gratuitement : 

Ecrire un programme qui fait le tri croissant d'un tableau entré au clavier .


Solution : 

#include<iostream.h>
int main()
{int array[5]={50,32,93,2,74};
int sure=0;
int x=0;
cout<<"Here is the Array befor sorted\n" ;
for (int j=0;j<5;j++)
cout<<array[j];
for (int i=0;i<5-1;i++) {
sure=0;
for (int j=i; j<5;j++) {
if (array[j] <array[i]){

x=array[j];
array[j]=array[i];
array[i]=x;
sure=1;}}
if (sure ==0) break;}
cout<<"Here is the Array after sorted\n";
for (i=0;i<5;i++)
cout<<array[i]<<"\n";
}


---------------------------------------------------
apprendre C++ facilement , rapidement et gratuitement .

1 commentaire:

  1. How to use my account with a free $10 casino chip
    Use $10 casino chip bonus code “STARS50” for new players. 용인 출장안마 삼척 출장샵 Deposit and make a $10 casino chip 하남 출장안마 deposit at 충청북도 출장샵 a US casino. 포항 출장안마

    RépondreSupprimer

Copyright © 2013 Exercices Langages de Programmation | Powered by Blogger
Design by Theme Junkie
Blogger Template by Lasantha | PremiumBloggerTemplates.com