Solved

Pseudocode

Posted on 1998-09-15
3
445 Views
Last Modified: 2012-05-04
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 1

Accepted Solution

by:
marvinm earned 100 total points
Comment Utility
One suggestion: Do not increment POSITION until after you have checked ARRAY(POSITION).

0
 
LVL 6

Expert Comment

by:Triskelion
Comment Utility
POS_COUNT and NEG_COUNT have no initial value, so you cannot count on the the final result.

So, set the initial value on both variables to zero.
0
 

Author Comment

by:yllee
Comment Utility
Thank you very much.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

771 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

10 Experts available now in Live!

Get 1:1 Help Now