Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Pseudocode

Posted on 1998-09-16
3
Medium Priority
?
309 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 150 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

618 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