GFXVoid Graphic Design Forum

Remove Text Formatting
Loading...

» Online Users: 2,045

0 members and 2,045 guests
No Members online

» Site Navigation

 > FAQ

» Stats

Members: 35,442
Threads: 103,075
Posts: 826,688
Top Poster: cc.RadillacVIII (7,429)
Welcome to our newest member, Lekelindids
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2005
    Location
    Calgary, Canada
    Posts
    2,566

    Default

    Is there anyway to make a case statement of an array? I am doing my CPSC assignment and having trouble with this mother.. I'm no coder hahaha

    Well the program is supposed to prompt you to enter letter grades of a class of 25 students, it will convert ABCDF grades into GPA scores, and W will be a null value.... if the user decides to quit he/she can enter in 'Q' or 'q', and the loop will stop...

    I have most of the program typed out, compiles and displays, but I'm moving on the next step.

    So far my program will display ANY letter grade, so I decided to use a Case Statement.

    I made the array type so I can pass into parameters of procedures:

    type
    gradeList = array(1..classMax)of char;
    **classMax is 5 students for now for testing**

    and the array itself..
    classGrades : gradeList

    The input procedure is

    procedure enterGrades (var classGrades : gradeList;
    * * * * * * * * * * * var size* : integer);
    begin
    * var i* * * * * : integer;

    * for i:=1 to classMax do
    * begin
    * * * writeln('Student #',(size+1),' Max students= ',classMax);
    * * * write('Enter the letter grade for student #',i,': '
    * * * readln(classGrades[i]);

    * * gradeInput(classGrades,size);
    Now my problem is gradeInput procedure. It is the procedure of which it is checking if the values entered are valid. Also I need to find a way to get out of the loop without compromising the student counter in the FOR loop (size+1.

    I tried doing this:

    procedure gradeInput(var classGrades : gradeList;
    * * * * * * * * * * * * * * * * * * var size* * * * * * :* integer);
    begin
    * var i : integer;* <-- in case I need it
    * case(classGrades)* <--- I tried both classGrades and classGrades[i]
    * * &#39;A&#39;,&#39;a&#39;, etc. until &#39;F&#39;,&#39;f&#39;:* * <-- I didn&#39;t actually type etc and all that jazz
    * * * size=size+1 (it is valid so the student counter goes up

    etc.
    It won&#39;t compile&#33; probably because I don&#39;t know how to use case statements to read arrays

    Any help from coders is appreciated haha. Long read indeed.
    It's MORPHIN' time!
    github
    deviantART
    Last.FM
    carrotderek

  2. #2
    Join Date
    Dec 2004
    Location
    GFXVoid
    Posts
    4,412

    Default

    Good luck finding help with pascal on here, not many people use that language nowadays. Try http://www.programmingtalk.com/ for your support questions, they&#39;ve helped me with other various things in the past.

  3. #3
    Join Date
    Jul 2005
    Location
    Calgary, Canada
    Posts
    2,566

    Default

    Thanks you so much &#33; :P
    It's MORPHIN' time!
    github
    deviantART
    Last.FM
    carrotderek

Similar Threads

  1. Favor Coding.
    By ThatTechPlace in forum Digital Art
    Replies: 1
    Last Post: 06-10-2006, 11:32 PM
  2. Slicing + Coding
    By Ben in forum Other Tutorials
    Replies: 7
    Last Post: 04-11-2006, 08:55 PM
  3. Coding help!!!
    By Ben in forum The Void
    Replies: 7
    Last Post: 01-14-2006, 05:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBadvanced CMPS v4.1.1