Go Back   The Scream! > COMMUNITY FORUMS > General Chatty Stuff
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1  
Old 15-May-2008, 18:28
geoffw geoffw is offline
Screamer
 
Join Date: May 2005
Location: West Wales
Posts: 66
Default Can anyone explain to me how to tackle this?

__________________
Geoff
Reply With Quote
  #2  
Old 15-May-2008, 18:36
El Gringo El Gringo is offline
Screamager
 
Join Date: Feb 2005
Posts: 945
Default Re: Can anyone explain to me how to tackle this?

Using a column for the sum and the counter, I followed the flowchart, noting down the values as I went.

Code:
S C 0 1 Move zero to sum, move 1 to counter. 1 2 Add counter to sum, add one to counter. 3 3 6 4 10 5 15 6 Counter > 5, so print the sum.
So unless I'm mistaken, the answer is 15.
Reply With Quote
  #3  
Old 15-May-2008, 18:47
geoffw geoffw is offline
Screamer
 
Join Date: May 2005
Location: West Wales
Posts: 66
Default Re: Can anyone explain to me how to tackle this?

Now I was stopping at 10, but, of course, the logic tells you to stop WHEN Counter is >5 not before as I was assuming - Thanks!
__________________
Geoff
Reply With Quote
  #4  
Old 15-May-2008, 22:26
silver's Avatar
silver silver is offline
 
Join Date: Apr 2001
Location: Bournemouth, UK
Posts: 11,443
Default Re: Can anyone explain to me how to tackle this?

must be bored..

Code:
my $iSum = 0; my $iCounter = 1; while (1) { print "Sum is [$iSum] Counter is [$iCounter]\n"; $iSum = $iSum + $iCounter; $iCounter = $iCounter + 1; if ($iCounter > 5) { goto END; } } END: print "Finished Sum is [$iSum] Counter is [$iCounter]\n";
Sum is [0] Counter is [1]
Sum is [1] Counter is [2]
Sum is [3] Counter is [3]
Sum is [6] Counter is [4]
Sum is [10] Counter is [5]
Finished Sum is [15] Counter is [6]
Reply With Quote
  #5  
Old 23-May-2008, 13:35
jenonnet's Avatar
jenonnet jenonnet is offline
Foxy Lady
 
Join Date: Apr 2005
Location: UK
Posts: 120
Smile Re: Can anyone explain to me how to tackle this?

I worked the correct answer out but can anyone tell me what the letter A in a circle means? I managed to get the right answer without taking any notice of it but I'd like to know what it means please, if anyone can tell me.
__________________
The truth is out there ...........
Reply With Quote
  #6  
Old 23-May-2008, 15:46
Austin_KW Austin_KW is offline
Screamager
 
Join Date: Feb 2007
Posts: 842
Default Re: Can anyone explain to me how to tackle this?

I worked the correct answer out but can anyone tell me what the letter A in a circle means? I managed to get the right answer without taking any notice of it but I'd like to know what it means please, if anyone can tell me.
Originally Posted by jenonnet View Post
Not sure what convention this is, but in other graphical languages the circle is called a connector. It allows you to split a diagram/design over multiple pages or graphs.

So you could have
(A)--> on one diagram
and -->(A) on another but (A) is the same logical point.
Also you can have many -->(A) ie many paths can take you back to A. But only one instance of (A)-->

In this case the "NO" output of the decision goes back to the original (A) but it could just as easily go to another connector labeled (A) and it would mean the same thing;

Think of it like a label if that helps.
Reply With Quote
  #7  
Old 23-May-2008, 17:36
jenonnet's Avatar
jenonnet jenonnet is offline
Foxy Lady
 
Join Date: Apr 2005
Location: UK
Posts: 120
Smile Re: Can anyone explain to me how to tackle this?

Ah, now it all becomes clear!!! Thanks for that explanation Austin.
__________________
The truth is out there ...........
Reply With Quote
  #8  
Old 25-May-2008, 01:26
silver's Avatar
silver silver is offline
 
Join Date: Apr 2001
Location: Bournemouth, UK
Posts: 11,443
Default Re: Can anyone explain to me how to tackle this?

yep - I think (A) is unneeded really, the arrow with "NO" could just as easily go back to the box directly below (A) with "ADD COUTER TO SUM" written in it ?
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Net firms tackle Vista headache everton66 Broadband Internet Access 1 21-March-2007 16:09
Explain monthly broadband useage Worldlife Broadband Internet Access 0 08-March-2005 18:17
Conference to tackle lack of rural BB gem Broadband Internet Access 0 09-June-2003 14:16
Wanted: Beachcaster rod & tackle fabienne00 Web Shopping 0 28-January-2002 10:16


All times are GMT +1. The time now is 14:05.


Powered by vBulletin® Version 3.6.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©1999-2006 The Scream!