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-15
3
Medium Priority
?
456 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 400 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

597 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