Not sure how to start a Pseudo for an Array

  • Thread starter Thread starter Aoxx
  • Start date Start date
  • Tags Tags
    Array
AI Thread Summary
To start writing pseudo code for an array, it's important to define the array size based on expected data, such as "array 1..200 of real numbers." The process involves reading input values until a specific condition, like a negative number, indicates the end of data. A loop can be used to continuously read numbers, storing valid entries while terminating the loop upon encountering the end condition. This structure allows for counting and averaging the test scores effectively. Understanding these foundational steps is crucial for creating functional pseudo code for array manipulation.
Aoxx
Messages
1
Reaction score
0
I am VERY new to this, i am trying to start a pseudo code write where i need to make an array. I have my flowchart done (at least i think i do ) but i am not sure how to actually start the code. The examples my teacher had are confusing and he is not answering my emails. I have to write pseudo for a count and averager for a test given to a class but the total count of tests done is not known. My issue to start is how i *actually* make the array list/space in pseudo. Any advise would be helpful and or examples of a start code with the array sections pointed out. Thank you.
 
Physics news on Phys.org
If you are using an array, then in most languages you will have to set aside a sufficiently-large array that it will be able to accommodate all expected data sets.

Code:
mark: array 1..200 of real numbers;

Then you'll read in marks one after another, until something indicates end of data
Most languages have a character or key that serves this function, but you might choose to say that a negative number will be used to indicate end of data

Code:
begin

loop through this block
  read a number
  if number >=0 store it as a mark
     else end this loop and go to the next stage

...
...
...
 

Similar threads

Replies
3
Views
1K
Replies
21
Views
3K
Replies
5
Views
2K
Replies
1
Views
1K
Replies
2
Views
1K
Replies
4
Views
5K
Replies
15
Views
2K
Back
Top