Not sure how to start a Pseudo for an Array

  • Thread starter Thread starter Aoxx
  • Start date Start date
  • Tags Tags
    Array
Click For Summary
SUMMARY

The discussion focuses on writing pseudo code for creating an array to count and average test scores, specifically when the total number of tests is unknown. The user seeks guidance on initializing an array in pseudo code, with an example provided: "mark: array 1..200 of real numbers;". The process involves reading numbers until a negative number is encountered, which indicates the end of data input. This approach is standard across many programming languages, emphasizing the importance of defining array size and termination conditions.

PREREQUISITES
  • Understanding of pseudo code syntax
  • Basic knowledge of arrays and their structure
  • Familiarity with control flow concepts such as loops and conditionals
  • Awareness of data input methods in programming
NEXT STEPS
  • Research how to implement arrays in specific programming languages such as Python or Java
  • Learn about data input techniques and end-of-input indicators in programming
  • Explore examples of pseudo code for counting and averaging data sets
  • Study control flow structures, particularly loops and conditional statements in pseudo code
USEFUL FOR

This discussion is beneficial for beginners in programming, educators teaching pseudo code, and anyone interested in understanding array manipulation and data processing techniques.

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
7
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 21 ·
Replies
21
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
9
Views
2K
  • · Replies 4 ·
Replies
4
Views
5K
Replies
1
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K