Hi I'm very new to this world of programming and am having several difficulties. I'm trying to practice a lot and become more accustomed to everything but I've only been doing this for about five weeks so I'm sure know it's usually a slow start.

I would like to build a program to keep track of students grades. I will enter five students names and it needs to keep track of at least 10 grades for each student. I would like to be able to ask for the grades for each specific student or all and then have each grade and an average for each student. Which is the best way to start something like this. I'm extremely new but learn easily but just haven't been able to find the resources to teach me as well as I would like to know.

Thanks,

you will probably want to create a structure to hold the information for each student, something like this:

struct student
{
   char name[80];
   int grades[10];
}

Now you will have to declare an array of 5 of those structures. Then create a loop that prompts for student name and the grades, then add this information to the ith array element structure.

Ok here's what I have so far for this program. What does it need?

//Student grades program

#include <stdio.h>

main()

char cStudent[5][10];
char cStudent[0] = {0};
char cStudent[1] = {0};
char cStudent[2] = {0};
char cStudent[3] = {0};
char cStudent[4] = {0};
int rows;
int cols;
int Grades;
char name;
char number;

{

for (int rows = 0; rows <=5; rows++) 
{ 
("Please enter a name");
scanf("%d", cStudent[5]);
cStudent[5][cols] = name;
}

for (int cols = 1; cols <=10; cols++)
   for (int rows = 1; rows <=5; rows++)
{
printf("Please enter a grade");
scanf("%d", number);

Grades[rows][cols] = number;
}   


getchar();
}

>What does it need?
It needs to be sanded down all the way from 120 to 150 grit sand-paper.
After that it needs a 3 coats of polyurethane, waiting at least a couple
hours in between coats. Make sure you sand with 480 grit the finish between coats.
Oh!, You meant something else...
Try to compile it. Check that it does what you want it to do.
Report here any errors or bugs you can't figure out how to fix. That's what it needs.

Now I can tell you what you need to learn in order to be able to write that piece of code.
You need to learn about arrays of characters, and how to use them. You need to learn about structures, and how to obtain a string inputed from a user. About that last one, first thing will not to use scanf() for reading a name from the user.
Maybe this link would help you. Here's another one that might be helpful. Don't hesitate to peruse a little bit more in those link pages
and see if there's any more you can learn.

After that if you want people to be happier of giving you a promted answer to your coding problems, learn how to properly tag you posted code, here's some more information about it.

Happy coding.

delete lines 7 thru 11 because they are invalid statements. change line 6 like this

char cStudent[5][10] = {0};

Move line 18 after line 4. The brace goes immediately after the function declaration (unless you use ancient K&R original style, which you are not).

This snippet shows you how to get input from user in a more of less safe way, without using scanf(). Apply the concept, now to as many students as you want.

/*
 * students.c 
 * gets 10 grades from one student
 * displays the grades and average
 */

#include <stdio.h>
#include <string.h>

int main( void )
{
    char one_name[30] = { '\0' };
    int  grades[10] = { 0 };
    float average;
    int len;      
    int i;

    /* get name */
    fputs( "Enter student name: ", stdout ); /* display request */    
    fflush( stdout );                       
    if( fgets( one_name, sizeof one_name, stdin ) ) /* get name from user */
    {
        /* checking for that elusive newline */
        len = strlen( one_name ) - 1; 
        if(  one_name[ len ] == '\n' )
        {
            one_name[ len ] = '\0';
        }
        else
        {
            while( getchar() != '\n' );
        }
    }

    /* get grades */
    printf( "Enter grades for student %s:\n", one_name );
    len = sizeof grades / sizeof ( int ); /* how many grades it can get */ 
    for( i = 0; i < len; i++ )
    {
        char temps[20] = { '\0' };
        printf( "grades #%d: ", i + 1 );
        fflush( stdout );
        if( fgets( temps, sizeof temps, stdin ) )
        {
            int number;
            char newline;
            if( sscanf( temps, "%d%c", &number, &newline ) == 2 )
            {
                grades[i] = number;
            }
        }
    }

    /* Display name and grades */
    printf( "Grades for student: %s\n", one_name );
    for( i = 0; i < len; i++ )
    {
        printf( "grades #%d: %d\n", i + 1, grades[i] );
    }
    
    /* display average */
    for( i = 0; i < len; i++ )
    {
        average += grades[i]; 
    }
    average /= len;
    printf( "Average grades: %.2f\n", average );

    getchar();
    return 0;
}
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.