Solved

Pseudocode

Posted on 1998-09-15
3
453 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
[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 1

Accepted Solution

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

0
 
LVL 6

Expert Comment

by:Triskelion
ID: 6989403
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
ID: 7434125
Thank you very much.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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 opening and writing to files in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

729 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