PLS HELP ME with this problem..

This is a discussion on PLS HELP ME with this problem.. within the C Programming forums, part of the General Programming Boards category; The program below is working good. But now i need to change the input as enter no of student : ...

  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    19

    Unhappy PLS HELP ME with this problem..

    The program below is working good. But now i need to change the input as
    enter no of student :
    enter no of subject :

    where the value is undefined 'x'. once i run the program it should ask for no of students and no of subject.when my input is
    10, automatically i want to have 10 student record and 10 subject...PLS HELP ON THIS...how to do it..
    Attached Files Attached Files
    Last edited by scorpio76; 10-25-2010 at 02:34 AM.

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Post your code to the forum directly, using code tags, please...

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    For the automatic part of it, I would prepare a text file with the 10 students name, ID and test scores. Then, if 10 is entered for number of students, open the file you've prepared, and read in the data.

    You should use an array to hold the students name (a char array), and either a char array or an integer array, to hold the students ID, depending on if the numbers will fit into an integer (or unsigned integer), on your system.

    If you include <limits.h> and printf("%d", INT_MAX), it will show you what your integer high range is. You might want to try it with ULONG_MAX , and see if it will hold your students ID number, as well. Otherwise, you'll need to use a char array for it.

    make the array big enough to hold all the test scores for a student, in a single row. Then you can have a 1 to 1 relationship of student name[0], goes with student_ID[0], goes with all the scores in testScores[0][0], testScores[0][1], testScores[0][2], etc.

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Adak View Post
    For the automatic part of it, I would prepare a text file with the 10 students name, ID and test scores. Then, if 10 is entered for number of students, open the file you've prepared, and read in the data.

    You should use an array to hold the students name (a char array), and either a char array or an integer array, to hold the students ID, depending on if the numbers will fit into an integer (or unsigned integer), on your system.

    If you include <limits.h> and printf("%d", INT_MAX), it will show you what your integer high range is. You might want to try it with ULONG_MAX , and see if it will hold your students ID number, as well. Otherwise, you'll need to use a char array for it.

    make the array big enough to hold all the test scores for a student, in a single row. Then you can have a 1 to 1 relationship of student name[0], goes with student_ID[0], goes with all the scores in testScores[0][0], testScores[0][1], testScores[0][2], etc.
    Wouldn't that be easier in an array of structs?

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Yes, but I have the idea that the OP hasn't been taught structs yet. What do you think?

  6. #6
    Registered User
    Join Date
    Sep 2010
    Posts
    19
    well no idea abt array or struct....i dont need to input names...the program should require number of students, no of subject and id no..

    the important part is numbers of subject and students is infinite..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pls help with this tutorial problem
    By pelisa in forum C++ Programming
    Replies: 1
    Last Post: 04-19-2010, 12:47 PM
  2. minor problem in up down counter - pls help
    By bondage in forum C Programming
    Replies: 15
    Last Post: 01-15-2010, 01:42 AM
  3. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 06:20 AM
  4. Spot the problem..a test question, pls help!
    By Unregistered in forum C++ Programming
    Replies: 10
    Last Post: 02-05-2002, 01:40 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21