# Thread: Need 10 names and grades and output their name, grade, and avg.

1. ## Need 10 names and grades and output their name, grade, and avg.

Ok, so I am a students and could use some help starting this program. The teacher told us to use arrays, but he has not taught us how to use them, and I am stuck right now. I don't even know how to start the program. The exact question program that needs to be made is:

Write a midterm exam grade-averaging program for a class of 10 students. Ignore any grade less than 0 and continue until all 10 students grades are entered, or until the user types –99 to end the program early. Must store last name and midterm exam grade. Must use a looping routine. Show each student's score and the class avg at the end.

Thanks ahead for any help anyone can give me.

Chris Scott

2. Chris,

First of all I recommend you search this forum or online resources and get familiar with the use of arrays in C. What you need for your assignment is very basic, so you should try to come up with how your algorithm is going to solve this problem. Make a diagram or just enumerate the steps you think are needed.

I will provide a hint. You need to use two arrays, one containing the names of the students, the other one containing the grades. Each of these arrays have 10 slots, the number of students in the class. Besides this you need a double variable to store the average of their grades.

array of names: "student 1" , "student 2" , ...... "student 10"
array of grades: A, C, B , .... A (or whatever grades/grade format you need, it may be an int 1-10 depending on where you live)

If you are inputting letter grades, then you are going to need to replace them with a real value when computing the average. (i.e. A is 4.0, B is 3.0, etc)

Keep in mind that most people here will help you but you need to show that you are making an effort and progress for yourself first. Nobody is going to do your homework for you. Setting up your algorithm in plain English is a good first step. Then when you don't know how to write a particular step in C, people will jump in and help you out.

Good luck!

3. some good resources on arrays:

Integer ones:
Chapter 2 - Pointers and Arrays
Arrays - Basic Introduction to Arrays

String one:
C Strings - C++ Tutorial - Cprogramming.com - Strings in C

by the way, some of the links i gave may refer to C++ but C and C++ arrays are
the same. any questions, then feel free to ask.

Popular pages Recent additions