Nazwa forum

Opis forum


#1 2007-10-19 10:52:02

abcd003

Administrator

Zarejestrowany: 2007-10-19
Posty: 8
Punktów :   

zad 2

#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<stdio.h>
#include<time.h>
#include<stdlib.h>


main()
{
  int i,j;
  int tab[10];
  int tmp;
  bool change;
  randomize();
  for (i=0; i<10; i++)
  { tab[i]=random(50);
  cout<<tab[i]<<endl;
  }
  cout<<"\n";
  cout<<"Liczby posortowane malejaco: \n";
  for (i=0; i<10; i++)
  {

      for (j=0; j<9-i; j++)
      if (tab[j+1] > tab[j])
  {
           tmp = tab[j];
           tab[j] = tab[j+1];
           tab[j+1] = tmp;
        }
  }
  for (i=0; i<10; i++)
  cout<<tab[i]<<endl;
  getch();
}

Offline

 

Stopka forum

RSS
Powered by PunBB
© Copyright 2002–2008 PunBB
Polityka cookies - Wersja Lo-Fi


Darmowe Forum | Ciekawe Fora | Darmowe Fora
www.anty-terorrysci.pun.pl www.transport81t1.pun.pl www.angell.pun.pl www.worldjumpstyle.pun.pl www.naruto-gn.pun.pl