 |
Sojusz Fallen Fallen
|
Zobacz poprzedni temat :: Zobacz następny temat |
Autor |
Wiadomość |
Ricko
Brain

Dołączył: 07 Sie 2006
Posty: 3255
Przeczytał: 0 tematów
Pomógł: 5 razy Ostrzeżeń: 0/5 Skąd: ..::Zabrze::..
|
Wysłany: Śro 12:05, 15 Maj 2013 Temat postu: STUDIA: Sortowanie Bąbelkowe + Wypisanie Operacji |
|
|
Cytat: |
#include <cstdlib>
#include <iostream>
#include <ctime>
using namespace std;
int main(int argc, char *argv[])
{
int tab[15];
int i,j;
srand(time(0));
cout<<"Losujemy i wypisujemy tablice"<<endl;
for (int i=0;i<15;i++)
{
tab[i]=rand()%30;
cout<<tab[i]<<" ";
}
cout<<endl;
cout<<endl<<"Operacje sortowania"<<endl;
for (i=0;i<15;i++)
{
for (j=0;j<14;j++)
{
if (tab[j]>tab[j+1])
swap(tab[j],tab[j+1]);
}
for (int i=0;i<15;i++)
{
cout<<tab[i]<<" ";
}
cout<<endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}
|
Post został pochwalony 0 razy
|
|
Powrót do góry |
|
 |
|
 |
|
|
Możesz pisać nowe tematy Możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach
|
fora.pl - załóż własne forum dyskusyjne za darmo
Powered by phpBB © 2001, 2002 phpBB Group
|