View difference between Paste ID: NyFcXqd7 and RAv0P9E0
SHOW: | | - or go back to the newest paste.
1-
 #include <iostream>
1+
#include <iostream>
2-
  2 
2+
3-
  3 
3+
4-
  4 int main()
4+
int main()
5-
  5 {
5+
{
6-
  6     int tablica[1,5,7,45,18,4,31,38,45,2,3,88,20,74,66];
6+
    int tablica[1,5,7,45,18,4,31,38,45,2,3,88,20,74,66]; // Opisz co chcesz zrobić w tej linijce na HO
7-
  7 
7+
8-
  8     int lastSmallVal =tablica[1];
8+
    int lastSmallVal =tablica[1];
9-
  9     int tmpArr[15]{};
9+
    int tmpArr[15]{}; //ukryta stała, takzwane magic number (antypattern)
10-
 10     int it=0;
10+
    int it=0;
11-
 11     // SORTOWANIE TABLICY:
11+
    // SORTOWANIE TABLICY:
12-
 12     for(int i=0;i<15;i++)
12+
    for(int i=0;i<15;i++) // ok, na razie robisz na stałej - gdybyś kiedyś musiał używać stałych używaj #define NAZWA <wartosc>...
13-
 13     {
13+
    {
14-
 14         for(int j=; j>=0;j--)
14+
        for(int j=; j>=0;j--) // brak wartości początkowej j
15-
 15         {
15+
        {
16-
 16             it= tablica[i];
16+
            it= tablica[i];
17-
 17             if(tablica[i] < tablica[it++])
17+
            if(tablica[i] < tablica[it++])
18-
 18             {
18+
            {
19-
 19                 continue;
19+
                continue;
20-
 20 
20+
21-
 21             }
21+
            }
22-
 22             else
22+
            else
23-
 23                 {
23+
                { // problem z formatowaniem - czego uzywasz do pisania, vim? Polecam jakies CodeLite, Code::Blocks, netbeans++ albo lepiej skonfigurowane vim
24-
 24 
24+
                  // rule of the thumb - choose CodeLite
25-
 25                 }
25+
26-
 26         }
26+
                }
27-
 27     }
27+
        }
28
    }
29
    return 0; // zmiana - nalezy podac return <wartosc_zwracana> - bo int main()...
30
}// brakowalo domkniecia main. zawsze warto robic to tak budujac koniec-poczatek i tylko wstawiac rzeczy w klamry