Ok, I am a complete noob at programming. As in I know nothing. I've made a few flowcharts, and written some pseudocode for my intro-level class, but most of that was just copying from a format within my textbook and manipulating the actual characters used for whatever I was doing. So far, so good. Well, now we are working with arrays, and I cannot, for the life of me, understand how to work them into either a flowchart or pseudocode.

The problem I'm working with has a scenario where you have 100 students, divided among 4 classes, and they've all taken a test. I need to average the grades, and find out how many scored above and below average.

So I'm assuming that I will need to declare(?) variables for the four classes, starting at zero (because ALL arrays start at zero, or just most? Another thing I don't understand lol), so it would be something like:

class(0)
class(1)
class(2)
class(3)

Now for the students, how do you do that with 100 of them? I find it hard to believe that within my pseudocode I'm supposed to write them all out (student(0),student(1), etc.)... Is there a way to notate that there are 100 of them? Or do you just write student(100) or student(1,100) and it's implied that there are 100 students?

Any help would be greatly appreciated. Also, if you could please explain this to me like I'm a toddler, that would be even better ;-)

Thanks in advance!

Recommended Answers

All 16 Replies

ALL arrays start at zero, or just most?

It varies depending on the language you use. In pseudocode, just specify which one you want and go with it. Pseudocode is, after all, just a faux programming language that helps you think in code better than flowcharts.

Or do you just write student(100) or student(1,100) and it's implied that there are 100 students?

There's something to be said for intuition. Both of those would be valid pseudocode. For example:

declare student(1, 100)

for i = 1 to 100
    assign grades to student(i)

I suppose the 4 classes is a hint to use a two-dimentional array.
Visualize 100 shoe boxes places on four shelves, 25 per shelf. So your class(0) would refer to one shelf. Now, how would you refer to any one of those boxes on that shelf? (0,x), (1, x), etc.
How would you popuate the array? Use a loop (for x == 0 to 99). This is not totally correct in your case (four classes, so for x == 0 to 3)
Inside the loop yyou would do the same for each box (loop inside a loop)

hi, this is my problem which i cant quite figure out... I need to give a report showing a MONTLHY list of "that" "that and "that" (in pseudocode), I do not want to put the question up in the exact words for those who try to find an easy way out. I only want some guidance or tips..and I will do the rest! I HAVE DECLARED an array mnth[12] string type
I used a FOR loop ((n)=1,(n)=12 +1)
MY QUESTION is how can I declare that (n)1 = january, (n)2= febuary, so on and so forth...
THANKS

Some programming languages have functions that will convert a number to its corresponding day of the week, or month name. In psuedo code stick to numbers 1 to 12 and convert them to month names when you want to display the report. It is easy enough to write your ouwn conversion function.

HI, thanks for replying.. so you wouldnt recomend that I use records and fields ? Because my tutor told me so,however i got more confused.. How could I implement record/field to my pseudo? through parameters?

If your instructor want you to user records and fields then it is best you do so. If you want to work with month names in an array you can assign them directly, not in a loop.
Using records/fields:
Declare a structure consisting of all the fields for one record.
Declare an array containing the number of structures you need.
Loop through the array to assign/retrieve one record at a time.

Well, its pseudocode and there are no rules to it. I decided to use an array and he liked the idea. but he just told me to remember and include records and fields. just don't know how to go about it, Record MONTH
HAS FIELDS name:january
IS THIS right?
THANKS AGAIN so much
regards

Yes that would be a valid record

Ok great, thanks again for the help.. I was afraid that I did not grasp the concept of pseudocode and even more so because its just a "fake" code, and wondered how i would do with real coding.Anyways,Best Regards cheers.

"Real code" is easier if you use an IDE. The IDE give you hints and suggestions.
Enjoy your studies.

"Real code" is easier if you use an IDE. The IDE give you hints and suggestions.
Enjoy your studies.

"Real programmers" don't need an IDE. They actually know what they're doing.

AND So i've heard :)..
thanks

"Real programmers" don't need an IDE. They actually know what they're doing.

That doesn't make IDEs unuseful though, it just means "real programmers" won't pass out if someone takes their IDE away. ;)

"Real programmers" don't need an IDE. They actually know what they're doing.

You are totally out of order with this response, this discussion was to help a student in such a way that he/she gains knowledge and confidence, not for you to blow your horn about your superior skills. Start your own IDE versus vi/Notepad thread elsewhere.

You are totally out of order with this response, this discussion was to help a student in such a way that he/she gains knowledge and confidence, not for you to blow your horn about your superior skills. Start your own IDE versus vi/Notepad thread elsewhere.

Please read this. Specifically, this paragraph:

When you perceive rudeness, try to react calmly. If someone is really acting out, it is very likely a senior person on the list or newsgroup or forum will call him or her on it. If that doesn't happen and you lose your temper, it is likely that the person you lose it at was behaving within the hacker community's norms and you will be considered at fault.

We have a team of moderators who are well versed in the rules and enforce them objectively, so if you have a problem with any post, it's best to simply report it with the "Flag Bad Post" button. Lashing out verbally is more likely to be counterproductive than anything.

Also, given that you were the one who brought up IDEs when they aren't exactly topical for the thread, it's unreasonable to attack others for continuing that tangent.

There are many types of array uses in programming language like one dimensional,two dimensional,three dimensional,multi dimensional.In C & c++ language array used the most.It is use for declare the structure.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.