d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > C++ Noob Question
Prev12
Add Reply New Topic New Poll
Member
Posts: 5,913
Joined: May 6 2009
Gold: 0.00
Oct 5 2013 03:59pm
Quote (carteblanche @ Oct 5 2013 10:15pm)
check if their list is sorted. if it's not, then display it's not sorted. not sure what your problem is.


that is exactly the problem, how do I write a code that checks that '-'
Member
Posts: 11,610
Joined: Oct 28 2008
Gold: 1,795.00
Oct 5 2013 04:16pm
Quote (0n35 @ Oct 5 2013 02:48pm)
In pseudo code:

Code
dim increase int = 0
dim decrease int = 0
For x=1 to len(integersarray) {
  if integersarray(x) <= integersarray(x+ 1) {
    increase = increase + 1;
  }
  if integersarray(x) >= integersarray(x + 1) {
    decrease = decrease + 1;
  }
}

if increase = len(integersarray) { echo Increases }
if decrease = len(integersarray) { echo Decreases }


Quote (bomben @ Oct 5 2013 04:59pm)
that  is exactly the problem, how do I write a code that checks that '-'


if you can't read don't post
Member
Posts: 5,913
Joined: May 6 2009
Gold: 0.00
Oct 5 2013 04:19pm
Quote (0n35 @ Oct 5 2013 11:16pm)
if you can't read don't post


oh sorry, I'll take a look at that code. Thanks
Go Back To Programming & Development Topic List
Prev12
Add Reply New Topic New Poll