Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7997249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:55:43+00:00 2026-06-04T14:55:43+00:00

The problem is that I am not sure how to load the data from

  • 0

The problem is that I am not sure how to load the data from keyboard to a two dimentional array when column number is unknown. Specifically, I need a program to store students’ grades for 4 subjects whithout knowing the actual number of students.

I have come up with this (I am fairly certain that the decision is faulty, but it’s the best I’ve got so far):

Declare Grades as dynamic two dimentional array of int
 Loop: Subject = 1 to 4
 Print 'Enter students grades for subject' + Subject#
 Print 'Enter * when done'
 If Grades <=100 && Grades >=0 then
  While Grades <> '*'
   Enter Grades w/o cursor return
  WhileEnd
  Else
   Print 'Enter a valid grade'
 EndIf
 LoopEnd: Subject

I guess that it’s not clear from this code how the Subject loop functions, i.e. when it goes from subject1 to subject2 and so on. I initially thought that to achieve the goal I would simply need to return cursor (which would have been done after a user entered ‘*’), but it’s hardly true, is it?

So could you please-please help me understand this problem better?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:55:45+00:00Added an answer on June 4, 2026 at 2:55 pm

    A couple of things are wrong with your pseudocode:

    1. You’re trying to validate grade before you have read it
    2. You’re not explicitly populating the 2-dimensional array Grades
    3. You’re not dealing with the student index into the array

    If you’ll like to iterate over the subjects and then the students, you could do it this way:

    Declare Grades as dynamic two dimensional array of int
     Loop: Subject = 1 to 4
       Print 'Enter students grades for subject' + Subject#
       Print 'Enter * when done'
       initialize student = 1
       Repeat 
         Read Grades[student, subject] from the keyboard
         If Grades[student, subject] <=100 && Grades[student, subject] >=0 then
           student = student + 1
         Else
          Print 'Enter a valid grade for ' + student + ' in subject ' + subject
         EndIf
       Until Grades = '*'
     LoopEnd: Subject
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SimpleProducerConsumer class that illustrates a consumer/producer problem (I am not sure
I have a report that needs to get data from two logical areas of
I have a UITabBar Application with two views that load large amounts of data
I have a strange problem that I could not solve. When I try to
I have a problem that I have not faced before: It seems that the
I faced a problem that I can not find a way to change the
Problem: to show that a Not-SO-page has been discussed in SO when you at
I have a problem that someone introduced a bug but I do not know
I've got the problem that the UIAlertViewDelegate method - (void)alertViewCancel:(UIAlertView *)alertView is not called
I have a problem that happens in IE 8 and Firefox 6.0 but not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.