Thread: Student Management Program help

  1. #1
    Registered User
    Join Date
    Nov 2015
    Posts
    2

    Student Management Program help

    Hi I've been trying to work on this assignment for a while now and I am stuck. I am not sure how to use the command line argument. This is just one part of the assignment, I would like some help getting started on this assignment to help me figure out how to do the rest of it.

    Commands
    Add Command: A
    <FirstName> <LastName> <StdID> <MathGrade> <MusicGrade> <PEGrade>



    For this command the program should add a new student with the given information to the list of thestudents. The program should not print anything for this command.

    This is what I have, any help would be appreciated. thank you.

    insert
    Code:
    int main(int argc, char *argv[])
    {
        char ch, *p, *q;
        char A[STR_LEN + 1], L[STR_LEN + 1], *first[STR_LEN + 1], *last[STR_LEN +1], stdID[1000];
        p = &first[0];
        int i;
        while(ch != 'Q')
        {
            scanf("%s", &A);
        if(ch == 'A')
        {
            printf("%s", argv[0]);
            for (i = 0; i < argc; i++)
            {
                printf("%s", argv[i]);
            }
        }

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Hi I've been trying to work on this assignment for a while now and I am stuck. I am not sure how to use the command line argument. This is just one part of the assignment, I would like some help getting started on this assignment to help me figure out how to do the rest of it.
    My first question would be are you sure that the program is supposed to use command line arguments? You've described a program that works something like this:

    ./prog A John Public 10001 94.44 72.80

    If so, I really think you are headed in the wrong direction, as the code looks like a bizarre fusion of a menu-driven interface and a command line that is hard to use.

    What is A? You're reading it wrong.
    Code:
    scanf("%*.s", STR_LEN, A);
    But as I said before, scanf() does not read the command line, so the best fix may be to delete it.

    For this command the program should add a new student with the given information to the list of thestudents.
    So where is the list in your code?

    The program should not print anything for this command.
    If the program ends after the A command, note that any changes would not be persistent between runs of the program, unless a file was used.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 17
    Last Post: 11-16-2013, 06:18 PM
  2. Replies: 2
    Last Post: 09-04-2011, 06:36 AM
  3. Student records program
    By mugiwara528 in forum C Programming
    Replies: 3
    Last Post: 03-14-2011, 02:53 AM
  4. Replies: 2
    Last Post: 04-03-2009, 05:57 PM
  5. Student Grade Program
    By Vinod Menon in forum C Programming
    Replies: 5
    Last Post: 05-28-2004, 02:49 PM