Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
inkrement/dekrement
Author Message
Mr.JA Offline
Novi korisnik
*

Posts: 58
Joined: Jul 2008
Reputation: 0
Post: #1
inkrement/dekrement
može neko objasnit ovo ?
samo požurite sutra mi kontrolniPalac-dole
ako neko ima volje - može objasnit na nekom primjeru
unaprid fala
(This post was last modified: 19-03-2009 05:47 PM by Mr.JA.)
19-03-2009 05:43 PM
Find all posts by this user Quote this message in a reply
schmrz Offline
____
*

Posts: 569
Joined: Feb 2007
Post: #2
RE: inkrement/dekrement
Inkrementiranje je operacija u kojoj se vrijednost "podize" za jedan. Npr: val = val + 1. To drugo je samo suprotna operacija :)

I have no drinking problems. I drink. Get drunk. Fall down. NO PROBLEM
Registered As Linux User #484215
Moj skromni blog
Savjet za buduće programere: ovdje
19-03-2009 07:44 PM
Find all posts by this user Quote this message in a reply
Mr.JA Offline
Novi korisnik
*

Posts: 58
Joined: Jul 2008
Reputation: 0
Post: #3
RE: inkrement/dekrement
ok, ali evo ja ću ti pokazat jedan primjer pa molin da neko objasni KAKO je to rješeno:
x=20;
y=(x++)-5
---------
y=20-5;
y=15
x=21
y=21-15=6;
------------------jel ovo iznad ikrement ili ddekrement?
19-03-2009 07:53 PM
Find all posts by this user Quote this message in a reply
Gogy Offline
____
*

Posts: 2,352
Joined: Feb 2006
Post: #4
RE: inkrement/dekrement
increment....

dakle:
x++ (increment)
x-- (decrement)

x = 5;
x++ (rezultat je 6)

x = 5
x-- (rezultat je 4)

Pravila foruma | Twitter - Facebook - Google+ |


Radar404 <- moj blog
19-03-2009 08:08 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Mr.JA Offline
Novi korisnik
*

Posts: 58
Joined: Jul 2008
Reputation: 0
Post: #5
RE: inkrement/dekrement
znači
x++ i ++x je isto samo drugačiji način
19-03-2009 08:56 PM
Find all posts by this user Quote this message in a reply
Gogy Offline
____
*

Posts: 2,352
Joined: Feb 2006
Post: #6
RE: inkrement/dekrement
Isti učinak dobiješ a to je da se vrijednost poveća za 1.

Ali ako napišeš

x = 10;
cout << "Ovo je broj" << x++;
ispisat će 10 i onda će povećat broj varijable.

A ako bude ++x onda će ispisat odmah 11

Pravila foruma | Twitter - Facebook - Google+ |


Radar404 <- moj blog
19-03-2009 09:38 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Mr.JA Offline
Novi korisnik
*

Posts: 58
Joined: Jul 2008
Reputation: 0
Post: #7
RE: inkrement/dekrement
ok fala
može lock
19-03-2009 09:47 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)