All pastes #927645 Raw Edit

zadaanie2

public cpp v1 · immutable
·published 2008-03-04 13:41 UTC
rendered paste body
#include <iostream.h>#include <stdlib.h>#include <conio.h>#define ARRAY_LENGTH 5unsigned int *tab;unsigned int tmp_value;unsigned int errors = ARRAY_LENGTH;void main(void){    tab = new unsigned int[ARRAY_LENGTH];    clrscr();    for(int g=0; g<ARRAY_LENGTH; g++)    {	tab[g] = rand()%700;	cout << tab[g] << endl;    }	while(errors > 0)	{	 errors = 0;	 for(int i=0; i<ARRAY_LENGTH; i++)	 {	  if(tab[i] > tab[i+1])	  {		tmp_value = tab[i];		tab[i] = tab[i+1];		tab[i+1] = tmp_value;		errors++;	  }	}    }    cout << endl;  for(g=0; g<ARRAY_LENGTH; g++) cout << tab[g] << endl; getch();}