Solved

Pseudocode

Posted on 1998-09-16
3
299 Views
Last Modified: 2010-04-16
Please help me correct all logical errors in the pseudocode below.  It is one of my course work.

    ------------------------------------------------------------
The pseudocode attempts to count the number of positive & negative numbers within 10 locations that are already stored into an array & at the end of process display POS_COUNT and NEG_COUNT.

    Set POSITION to 1
    DO while POSITION <= 10
       Increase POSITION by 1
       if ARRAY (POSITION) > 0 then
          Increase POS_COUNT by 1
       Eles
          Increase NEG_COUNT by 1
       Endif
       Display POS_COUNT, NEG_COUNT
    ENDDO

    ----------------------------------------------------------

Thank you very much in advance.....
0
Comment
Question by:yllee
3 Comments
 
LVL 4

Expert Comment

by:jack_p50
ID: 1215564
Maybe you need to output pos_count and neg_count after ENDDO
0
 
LVL 1

Accepted Solution

by:
ow earned 50 total points
ID: 1215565
Are you sure, that the array index counts from 2 to 11 and does not start at 1 (or 0)?
Besides you should initialize POS_COUNT and NEG_COUNT and display them after the loop (as mentioned by jack_p50).
Maybe you should try:

  Set POS_COUNT to 0
  Set NEG_COUNT to 0
  Set POSITION to 1
  DO while POSITION <= 10
      if ARRAY (POSITION) > 0 then
          Increase POS_COUNT by 1
      Else
          Increase NEG_COUNT by 1
          Endif
      Increase POSITION by 1
      ENDDO
  Display POS_COUNT, NEG_COUNT

0
 

Expert Comment

by:stupidguy23
ID: 1215566
stuff

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Help with If Then Statement 8 322
detect keyboard input monitoring 3 390
Delphi XE 5 - windows 3 855
How to use WebDispatcher to retrieve data 3 392
Marketing can be an uncomfortable undertaking, especially if your material is technology based. Luckily, we’ve compiled some simple and (relatively) painless tips to put an end to your trepidation and start your path to success.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now