<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="sr">
	<id>https://siwiki.rs/w/index.php?action=history&amp;feed=atom&amp;title=%D0%9F%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%B8%D1%80%D0%B0%D1%9A%D0%B5_2%2F%D0%9A2_2017</id>
	<title>Програмирање 2/К2 2017 - Историја измена</title>
	<link rel="self" type="application/atom+xml" href="https://siwiki.rs/w/index.php?action=history&amp;feed=atom&amp;title=%D0%9F%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%B8%D1%80%D0%B0%D1%9A%D0%B5_2%2F%D0%9A2_2017"/>
	<link rel="alternate" type="text/html" href="https://siwiki.rs/w/index.php?title=%D0%9F%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%B8%D1%80%D0%B0%D1%9A%D0%B5_2/%D0%9A2_2017&amp;action=history"/>
	<updated>2026-06-04T03:32:53Z</updated>
	<subtitle>Историја измена ове странице на пројекту</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://siwiki.rs/w/index.php?title=%D0%9F%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%B8%D1%80%D0%B0%D1%9A%D0%B5_2/%D0%9A2_2017&amp;diff=6786&amp;oldid=prev</id>
		<title>KockaAdmiralac: {{tocright}}</title>
		<link rel="alternate" type="text/html" href="https://siwiki.rs/w/index.php?title=%D0%9F%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%B8%D1%80%D0%B0%D1%9A%D0%B5_2/%D0%9A2_2017&amp;diff=6786&amp;oldid=prev"/>
		<updated>2023-10-30T01:06:38Z</updated>

		<summary type="html">&lt;p&gt;{{tocright}}&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;sr&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Старија измена&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Верзија на датум 30. октобар 2023. у 03:06&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Ред 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Ред 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{tocright}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Drugi kolokvijum 2017. godine&amp;#039;&amp;#039;&amp;#039; održan je 24. aprila. Zadaci i rešenja dostupni su sa [https://rti.etf.bg.ac.rs/rti/ir1p2/rokovi/2016_2017/13S111P2_K2_2016_2017_Resenja.pdf stranice predmeta.]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Drugi kolokvijum 2017. godine&amp;#039;&amp;#039;&amp;#039; održan je 24. aprila. Zadaci i rešenja dostupni su sa [https://rti.etf.bg.ac.rs/rti/ir1p2/rokovi/2016_2017/13S111P2_K2_2016_2017_Resenja.pdf stranice predmeta.]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key si:diff::1.12:old-6782:rev-6786 --&gt;
&lt;/table&gt;</summary>
		<author><name>KockaAdmiralac</name></author>
	</entry>
	<entry>
		<id>https://siwiki.rs/w/index.php?title=%D0%9F%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%B8%D1%80%D0%B0%D1%9A%D0%B5_2/%D0%9A2_2017&amp;diff=6782&amp;oldid=prev</id>
		<title>KockaAdmiralac: Ispravljen link + uvodni pasus</title>
		<link rel="alternate" type="text/html" href="https://siwiki.rs/w/index.php?title=%D0%9F%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%B8%D1%80%D0%B0%D1%9A%D0%B5_2/%D0%9A2_2017&amp;diff=6782&amp;oldid=prev"/>
		<updated>2023-10-30T01:05:47Z</updated>

		<summary type="html">&lt;p&gt;Ispravljen link + uvodni pasus&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;sr&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Старија измена&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Верзија на датум 30. октобар 2023. у 03:05&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Ред 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Ред 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;http&lt;/del&gt;://rti.etf.bg.ac.rs/rti/ir1p2/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;resenja&lt;/del&gt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;SI1P2_1617_K2_resenja&lt;/del&gt;.pdf &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Zadaci i rešenja na sajtu&lt;/del&gt;.]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#039;&amp;#039;&amp;#039;Drugi kolokvijum 2017. godine&amp;#039;&amp;#039;&amp;#039; održan je 24. aprila. Zadaci i rešenja dostupni su sa &lt;/ins&gt;[&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;https&lt;/ins&gt;://rti.etf.bg.ac.rs/rti/ir1p2/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;rokovi&lt;/ins&gt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;2016_2017/13S111P2_K2_2016_2017_Resenja&lt;/ins&gt;.pdf &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;stranice predmeta&lt;/ins&gt;.]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Zadatak==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Zadatak==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Prva funkcija===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===Prva funkcija===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key si:diff::1.12:old-713:rev-6782 --&gt;
&lt;/table&gt;</summary>
		<author><name>KockaAdmiralac</name></author>
	</entry>
	<entry>
		<id>https://siwiki.rs/w/index.php?title=%D0%9F%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%B8%D1%80%D0%B0%D1%9A%D0%B5_2/%D0%9A2_2017&amp;diff=713&amp;oldid=prev</id>
		<title>Ivan Pešić: Dodato resenje zadatka</title>
		<link rel="alternate" type="text/html" href="https://siwiki.rs/w/index.php?title=%D0%9F%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%B8%D1%80%D0%B0%D1%9A%D0%B5_2/%D0%9A2_2017&amp;diff=713&amp;oldid=prev"/>
		<updated>2020-07-28T15:31:05Z</updated>

		<summary type="html">&lt;p&gt;Dodato resenje zadatka&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Нова страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[http://rti.etf.bg.ac.rs/rti/ir1p2/resenja/SI1P2_1617_K2_resenja.pdf Zadaci i rešenja na sajtu.]&lt;br /&gt;
==Zadatak==&lt;br /&gt;
===Prva funkcija===&lt;br /&gt;
Realizovati funkciju &amp;#039;&amp;#039;&amp;#039;char *loadString()&amp;#039;&amp;#039;&amp;#039; koja učitava red teksta sa standardnog ulaza i vraća pokazivač na učitani string. String treba da zauzima samo onoliko prostora koliko je neophodno za smeštanje neophodnih znakova.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
char* loadString() {&lt;br /&gt;
    char *string = NULL;&lt;br /&gt;
    int size = 0;&lt;br /&gt;
    &lt;br /&gt;
    char c = getchar();&lt;br /&gt;
    while(c != &amp;#039;\n&amp;#039;)&lt;br /&gt;
    {&lt;br /&gt;
        string = realloc(string, (size+1)*sizeof(char));&lt;br /&gt;
        if(!string)&lt;br /&gt;
            exit(0);&lt;br /&gt;
        string[size++] = c;&lt;br /&gt;
        c = getchar();&lt;br /&gt;
    }&lt;br /&gt;
    string = realloc(string, (size+1)*sizeof(char));&lt;br /&gt;
    if(!string)&lt;br /&gt;
        exit(0);&lt;br /&gt;
        &lt;br /&gt;
    string[size] = &amp;#039;\0&amp;#039;;&lt;br /&gt;
        &lt;br /&gt;
    return string;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Druga funkcija===&lt;br /&gt;
Realizovati funkciju &amp;#039;&amp;#039;&amp;#039;int getNextDigit(char *string)&amp;#039;&amp;#039;&amp;#039; koja vreće poziciju prve cifre u stringu na koji pokazuje pokazivač string. U slučaju da string ne sadrži cifru povratna vrednost treba da bude pozicija null karaktera (&amp;#039;&amp;#039;&amp;#039;&amp;#039;\0&amp;#039;&amp;#039;&amp;#039;&amp;#039;).&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ctype.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int getNextDigit(char *string) {&lt;br /&gt;
    int i;&lt;br /&gt;
    for(i = 0; i &amp;lt; strlen(string); i++)&lt;br /&gt;
    {&lt;br /&gt;
        if(isdigit(string[i]))&lt;br /&gt;
            return i;&lt;br /&gt;
    }&lt;br /&gt;
    return i;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Treća funkcija===&lt;br /&gt;
Realizovati funkciju &amp;#039;&amp;#039;&amp;#039;char* substring(char *string, int start, int end)&amp;#039;&amp;#039;&amp;#039; koja vraća pokazivač na string formiran od karaktera stringa string koji se nalaze na pozicijama između &amp;#039;&amp;#039;&amp;#039;start&amp;#039;&amp;#039;&amp;#039; i &amp;#039;&amp;#039;&amp;#039;end&amp;#039;&amp;#039;&amp;#039;, uključujući i njih. Rezultujući string treba da zauzima onoliko prostora koliko je neophodno za smeštanje neophodnih karaktera.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
char* substring(char *string, int start, int end) {&lt;br /&gt;
    char* sub = malloc((end-start+2)*sizeof(char));&lt;br /&gt;
    strncpy(sub, string+start, end-start+1);&lt;br /&gt;
    sub[end-start+1] = &amp;#039;\0&amp;#039;;&lt;br /&gt;
    return sub;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Četvrta funkcija===&lt;br /&gt;
Korišćenjem prethodno realizovanih funkcija realizovati funkciju &amp;#039;&amp;#039;&amp;#039;char** split(char *string)&amp;#039;&amp;#039;&amp;#039; koja deli niz karaktera &amp;#039;&amp;#039;&amp;#039;string&amp;#039;&amp;#039;&amp;#039; i vraća pokazivač na niz podstringova. String se deli na osnovu graničnika. Dekadna cifra se koristi kao graničnik za podelu stringa na delove (podstringove). Graničnik je uvek jedna dekadna cifra, dok sami podstringovi ne sadrže cifre. Pri tome u niz stringova ulaze samo oni podstringovi čija dužina je manja ili jednaka cifri koja prethodi tom podstringu. Na kraju obrade rezultujući stringovi treba da zauzimaju samo onoliko prostora koliko je potrebno za smeštanje neophodnih znakova.&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
char** split(char *string) {&lt;br /&gt;
    char **c = NULL;&lt;br /&gt;
    int size = 0;&lt;br /&gt;
    int i = 0;&lt;br /&gt;
    while(string[i])&lt;br /&gt;
    {&lt;br /&gt;
        int len = 0;&lt;br /&gt;
        int num = string[i] - &amp;#039;0&amp;#039;;&lt;br /&gt;
        i++;&lt;br /&gt;
        int start = i;&lt;br /&gt;
        while(string[i] &amp;gt;= &amp;#039;a&amp;#039; &amp;amp;&amp;amp; string[i] &amp;lt;= &amp;#039;z&amp;#039; || string[i] &amp;gt;= &amp;#039;A&amp;#039; &amp;amp;&amp;amp; string[i] &amp;lt;= &amp;#039;Z&amp;#039;)&lt;br /&gt;
        {&lt;br /&gt;
            len++;&lt;br /&gt;
            i++;&lt;br /&gt;
        }&lt;br /&gt;
        if(len &amp;lt;= num)&lt;br /&gt;
        {&lt;br /&gt;
        char *sub = substring(string, start, i-1);&lt;br /&gt;
        c = realloc(c, (size+1)*sizeof(char*));&lt;br /&gt;
        c[size++] = sub;    &lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
    }&lt;br /&gt;
    c = realloc(c, (size+1) * sizeof(char*));&lt;br /&gt;
    c[size] = NULL;&lt;br /&gt;
    return c;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Glavna funkcija===&lt;br /&gt;
Korišćenjem prethodno realizovanoih funkcija napisati glavni program koji treba da učita red teksta sa standradnog ulaza, podeli string, ispiše dobijeni niz stringova i ponavlja opisani postupak dok se na standardnom ulazu ne unese prazan string.&lt;br /&gt;
&amp;lt;syntaxhighlight lang = &amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
&lt;br /&gt;
       char *in = loadString();&lt;br /&gt;
       &lt;br /&gt;
       char **splitted = split(in);&lt;br /&gt;
       int i = 0;&lt;br /&gt;
       while(splitted[i])&lt;br /&gt;
        {&lt;br /&gt;
            printf(&amp;quot;%s&amp;quot;, splitted[i++]);&lt;br /&gt;
            free(splitted[i-1]);&lt;br /&gt;
            if(splitted[i])&lt;br /&gt;
                putchar(&amp;#039;\n&amp;#039;);&lt;br /&gt;
        }&lt;br /&gt;
        free(splitted);&lt;br /&gt;
        free(in);&lt;br /&gt;
  &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[Категорија:Рокови]]&lt;br /&gt;
[[Категорија:Програмирање 2]]&lt;/div&gt;</summary>
		<author><name>Ivan Pešić</name></author>
	</entry>
</feed>